3
I have a string that will vary the values, I need to get the values inside the [],
{"time_zones":[]}
In case it would be empty, it may be filled:
{"time_zones":[teste]}
I’m trying to do it like this
var palavras = a.Split('[');
var palavra = palavras[1];
But he returns me the rest of the code: ]}
In case if there was nothing, the value was empty, if it was filled I needed the test. (this value varies);
You can do so... but if your string is an deseralizable as it seems, there are other approaches to it
– Leandro Angelo
Can solve @Leandroangelo, thanks.
– Mariana
Treating as string or Json?
– Leandro Angelo
String, I made this string[] split = a.Split(new char[] { '[', ']' }); Messagebox.Show(split[1]);
– Mariana
Would you accept a Regex? you’re trying to get the word test?
– Marconi
Yes I need to pick up the word test, but will not always have this word, including can contain other characters, and several words.
– Mariana
@marianac_costa added regex to your question, you said it could be :)
– Marconi
treats as json that is best....
– Rovann Linhalis
Definitely the @Rovannlinhalis comment is the following line. This is a json, treat it as such will make life easier. It is not worth the trouble to envision a solution of this kind, maintenance will charge expensive.
– Diego Rafael Souza
There will come a time
{"time_zones":[teste, teste2]}
to mess up the midfield (=C– Diego Rafael Souza