tags:

views:

71

answers:

1

Hello,

I am creating my own file tagging system for an application and have not found any relevant information on the subject.

My application appends tags to the end of a specified file, like so:

If the user wants to mark a particular file as private (for example), the following text will be appended to the end of the specified file:

$/private*


Now, I'm trying to figure out how I would extract those tags, and separate them when the file is loaded into my application:

For example, if the file has 3 tags, named "Private", "bad", "jokes". Then I want my application to get those tags and display them like so:

This file is marked as private, and contains bad jokes.

OR - Another way to show them would be:

This file has the following tags: Private Bad Jokes


Does anybody know how I would go about doing this? I'm thinking maybe using strings as I don't like Regex. It gives me headaches.

+1  A: 

you can put markers for marking beginning of tags and separate tags from each other:

main text of the file.......................
+++$$$+++private|bad|jokes+++$$$+++

then you can load the text of file and extract the tags based on the sentinels setup by you.

TheVillageIdiot
Thanks TheVilliageIdiot! This is excellent!! I completely understand your answer and am going to get on it right away, once I have it working, I'll post the code here for others to see.
baeltazor
Sure do post it @baeltazor that's why SO rocks!
TheVillageIdiot