I have a line of plaintext that contains a series of tags delimited by a plus sign:
event name @location +tag1 +tag2 +tag3 +tag4
The data fields alway sappear in the same order: Name, Location, Tags. There is always ONLY ONE instance of name and location, but there can be one or more tags. I'd like to be able to replicate the .NET StringSplit method (write all delimited strings to an array) in Java, but can't seem to wrap my head around doing it.
My desired output for the tag field from the above example would be:
tag[0] = tag1
tag[1] = tag2
tag[2] = tag3
tag[3] = tag4
First, the closest method I can find would be split which uses regex. But I'm not sure how I would code the regex to EXCLUDE from the array any characters that are before the first +.
I thought of getting a count of + in a particular row and using a for loop to parse and create tagString[count-of-plusses], but would that step through multiple instances of +nnnnn on a single line?
Any suggestions on a good way to approach this?