You are using Split
to split your main string on multiple different values, you could probably still retrieve the value you want, but using a different index.
Instead of trying to split your main string with both strings at once like your current code:
mainstring.Split(new[] { "{CODE_5:", "}" }, StringSplitOptions.None)[1];
try splitting it up, into two actions:
mainstring.Split(new string[] { "{CODE_5:" }, StringSplitOptions.None)[1].Split(new string[] { "}" }, StringSplitOptions.None)[0];
and see what you get.
This should first give you:
mainstring.Split(new string[] { "{CODE_5:" }, StringSplitOptions.None)[1]
=
https://[TS]/A_API/GetAccess.php}
{CODE_6:[K]}
{CODE_7:[IP]}
{CODE_8:[PP]}
{CODE_9:[Version]}
which can then be split on "}"
, which would give us:
mainstring.Split(new string[] { "{CODE_5:" }, StringSplitOptions.None)[1].Split(new string[] { "}" }, StringSplitOptions.None)[0]
=
https://[TS]/A_API/GetAccess.php
1
solved C# Something messed up with this function spilt() [closed]