I am trying to get the data of an array but I cannot access the index of this array
string s = "https://20.85.239.243:50000/b1s/v1/Orders(26)";
String[] numeroOrden = s.Split('(');
foreach (String numeroOrdens in numeroOrden)
{
String[] numOrden = numeroOrdens.Split(')');
foreach (String datos in numOrden)
{
Console.WriteLine(datos);
}
}
The Response of this code gives me
https://.85.239.243:50000/b1s/v1/Orders
26
I need to get data 26
You can do the following:
In the start variable you store the index where the character "(" is found , in the final variable you store the index where the character ")" is found , for this you make use of the IndexOf function later in the length variable you would store the size of the text to copy, and finally using the Substring function you would extract from the original string the substring you want.
I found this way to do it is somewhat more repetitive but it also works