Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: craigz on June 08, 2019, 11:05:15 PM
-
Hiya! :D
I went digging all over and can't seem to find this functionality :) is there a way to get the string characters between two characters? Currently parsing a CSV and there's some nested data between a set of brackets.
Usecase: I'm splitting the string into substrings, but then need to get the data between the [ ]
"Brian,King,Longbeards[enemy],red"
Let me know if I'm missing something that may already exist, totally possible ;D
best,
craigz
-
Hi.
If your [ and ] are only once in the string , you could use 'String Get Index Of' (Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181))
Get index of both [ and ]
Then use 'Get Substring'
You can use the [ index as start index (Possible index + 1)
Then from index ] deduct index [ to get the length (possible +1 or - 1)
I can't test at the moment if 1 needs to be added/subtracted from the indexes,
so you will have to try and find out.
Sorry for that.
-
Hmm... that SOUNDS like it should work! :D
Yep the bookend characters are only once per string, though I know that's not always the case for most people :)
I will test this soon and report back, thank you for the insight! :D
-
Hi, has this worked for you craigz?
-
Hi,
regex must be a far more powerful way to get it done:
https://hutonggames.com/playmakerforum/index.php?topic=7005.0
Bye,
Jean