0

In this scenario the data I could have in my string may look like below but keep in mind the ids are dynamically generated so this isn't static and could be more than 2 if you haven't caught onto that.

ing:server blah blah, you. 2019,;:10-!gs.csd 1. id=value, otherid=value, pos=(22,22,33) 2. id=value2, otherid=value2, pos=(2g,2g,f) info other info info info info etc etc.

EDIT: How am I supposed to extract the individual values into strings afterwards from the string, the following does not work:

String valueString = "csd 1. id=value, otherid=value, pos=(22,22,33) ";

String value = valueString.Substring(valueString.IndexOf("otherid"), valueString.IndexOf(",") - valueString.IndexOf("otherid"));
0

1 Answer 1

3

You can do with Substring since you have already way of expecting when to start and when to end on your searching.

string result = x.Substring(x.IndexOf("csd"), (x.IndexOf("info ") - x.IndexOf("csd")));

I start searching on the start of the word "csd" and ends with the word "info " (with space), since there is also a word of info at the beginning of your string.

The result would be:

"csd 1. id=value, otherid=value, pos=(22,22,33) 2. id=value2, otherid=value2, pos=(24,21,33) "
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.