Help with combining string varialbles into 1 string

Hello!

I have been banging my head against this for an hour and can’t seem to figure out what is going on. I am trying to combine 3 string variables into a single string, but when I type it into Notepad it adds an “enter” (new line) after each variable.

image

Thanks!
s3vn

Hi @s3vn, I’m sure there’s a better way to do it, but you can use the Assign control, see the attached image and file, hope it works for you.

Sequence.xaml (5.4 KB)

Hi @s3vn

Please make sure when you are fetching the vslue for these three values you have trimmed the trailing spaces.

Your variable contains that spaces. To confirm after fetching the values in variables just try to print that. You will see the difference.

Hope this helps.

Thanks,
Shenki

Hi @ShenkiSinghai,

I tried splitting the variables again to make sure there isn’t a trailing space and nothing changes.

Thanks,
s3vn

Can you please attach the screenshot how you are fetching these values.

Once you fetched the details with GetText activity, try with below. where ClientInformation is the variable where we are storing the output of GetText activity:

ClientId = ClientInformation.Substring(ClientInformation.IndexOf("Client ID: ") + "Client ID: ".Length).Split(Environment.NewLine.ToCharArray)(0)

ClientName = ClientInformation.Substring(ClientInformation.IndexOf("Client Name: ") + "Client Name: ".Length).Split(Environment.NewLine.ToCharArray)(0)

ClientCountry = ClientInformation.Substring(ClientInformation.IndexOf("Client Country: ") + "Client Country: ".Length).Split(Environment.NewLine.ToCharArray)(0)

I am assigning the variables this way:

GetDetailsSplit = Split(InfoDetails,vbLf)
CID_SPLIT = Split(GetDetailsSplit(2),": ")
(and repeated for the name and country)

image

Just try with my code, it will help you

@ShenkiSinghai

Thank you so much! I need to learn my vb script better, your code is working for me :slight_smile:

1 Like

Anytime. Happy automation.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.