dear all, i have a string like this, “…1name: john, 2name: lice, 3name: mike…”. i want to output its substring “1name: john”. its position in the string is not fixed. i also use the substring method but can not get it. so could you give me a help.
thank you.
I suggest making a map if the position is random:
The map will thus contain a list of person IDs to their respective value strings. If you wish to store names only as value elements of the map:
It’d be easier to use a StringTokenizer in the second example for the key=value pairs if you want to store more data, but I don’t know what your delimiter is. You’d also need to store objects as values of the map to store the info.