Assignment 1 Level 3 Substring

the Values are being fetched as
for example if need to fetch the
CLient ID :
ClientInfo.Substring(ClientInfo.IndexOf(“Client ID:”)+ “Client ID:”.Length).Split(Environment,NewLine.ToCharArray)(0)

Can anyone explain this code ?

1 Like

Suppose I’d we use get text activity and get that client id and if value as a whole string then the Substring expression would be like this

Str_output = Str_input.SubString(Str_input.IndexOf(“Client ID:”)+”Client ID:”.Length,
Str_input.Split(Enviroment.NewLine.ToArray())(0).Length-(”Client ID:”.Length)).Trim

Here the first argument

Str_input.IndexOf(“Client ID:”)+”Client ID:”.Length
—this denote last the index of string firm where we need to start extracting the Substring

And the second argument

Str_input.Split(Enviroment.NewLine.ToArray())(0).Length-(”Client ID:”.Length)
—this denote the number of character to be obtained from the mentioned start index

For example
Str_input = “Client ID: 12245asd
Client name :…”

Then as per the Substring expression
Str_output = Str_input.Substring(0+10,19-10).Trim
Str_output = Str_input.Substring(10,9).Trim

So the output would be @hasib08
Str_output = “12245asd”

Hope this would help you
Cheers @hasib08