Reputation: 11662
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
Upvotes: 0
Views: 553
Reputation: 40512
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.
Upvotes: 2