I extract data as shown below and i want to split them to get the info after the colon
and i use the function as shown for the ID, Name and Country but it throws an error which says “index is outside the bounds of the array”. Help please
Hi @Amr_Nweery
-
Use Get text activity to get the data → Store it as ClientInformation
-
use Assign activity to get Client ID
ClientInformation.Substring(ClientInformation.IndexOf("Client ID: ") + "Client ID: ".Length).Split(Environment.NewLine.ToCharArray)(0)
- use Assign activity to get Client Name
ClientInformation.Substring(ClientInformation.IndexOf("Client Name: ") + "Client Name: ".Length).Split(Environment.NewLine.ToCharArray)(0)
- use Assign activity to get Client Country
ClientInformation.Substring(ClientInformation.IndexOf("Client Country: ") + "Client Country: ".Length).Split(Environment.NewLine.ToCharArray)(0)
Regards
Gokul
Hi @Amr_Nweery
You can also try with regex method
- use Assign activity to get Client ID
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Client\sID:\s)(\S+)").Tostring
- use Assign activity to get Client Name
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Client\sName:\s)(\S.+)").Tostring
- use Assign activity to get Client Country
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Client\sCountry:\s)(\S.+)").Tostring
Regards
Gokul
Thank you it worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.