We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I have a .txt file with strings. And, you see that there are words that start and end with [ and ] respectively. My question is, how can I organize strings by these words. Imagine, the first word is [duck], how can I make that all strings from that and the next [] word are related in a Hashmap?
Thanks!
Answers
Hello ! What did you try ?
No, but what I want is to take what is after the [duck] and include put it in a HashMap.
Thanks for your fast answer
https://processing.org/reference/String_indexOf_.html
https://processing.org/reference/String_substring_.html
After reading the question three times, I am still unsure of what you want to do. I suggest to show a sample of text, and what is the expected result from that.
yes
please show the first ten lines. Does it look like
[duck] swims
[duck] is black
?
do you mean all [duck] together, so there are multiple lines with the word duck? Or Do you mean every word in [] ?
are related? Do you mean put them in a HashMap next to each other? hm. you could put together a class entity and one is duck? And the other is frog? And they all have fields like size, movement, color?
;-)