Split a string error of multiple data

I extract data as shown below and i want to split them to get the info after the colon
Capture
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
Capture

@Amr_Nweery
Try this

Split("Client: 123",":")(1)
Split(Split(clientDetails," ")(1),":")(1)

image

Hi @Amr_Nweery

  1. Use Get text activity to get the data → Store it as ClientInformation

  2. use Assign activity to get Client ID

ClientInformation.Substring(ClientInformation.IndexOf("Client ID: ") + "Client ID: ".Length).Split(Environment.NewLine.ToCharArray)(0)
  1. use Assign activity to get Client Name
ClientInformation.Substring(ClientInformation.IndexOf("Client Name: ") + "Client Name: ".Length).Split(Environment.NewLine.ToCharArray)(0)
  1. use Assign activity to get Client Country
ClientInformation.Substring(ClientInformation.IndexOf("Client Country: ") + "Client Country: ".Length).Split(Environment.NewLine.ToCharArray)(0)

image

Regards
Gokul

Hi @Amr_Nweery

You can also try with regex method

  1. use Assign activity to get Client ID
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Client\sID:\s)(\S+)").Tostring
  1. use Assign activity to get Client Name
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Client\sName:\s)(\S.+)").Tostring
  1. 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.