Remove comma from start of the string

Hi I have a doubt to remove a comma from string
string is “,name”
It should be just “name”
Used trimstart option. it didn;t work
any help?

Use the replace function, like str.replace(",","")

actually the string is “,name,name2,name3”
so if I use replace it removes all the commas
so I just want the 1st comma before name should be removed

You could use an if activity to check if the string starts with a comma.

str_Var.StartsWith(",") = True
Then, str_Var.Substring(1)

This will drop the first character, the comma, from the string.

It is providing the same result with comma. No changes using the above solution.

Any other easy option available?

You can try using Regex with this pattern and an Assign activity.

Left side of Assign

Right side of Assign

Hopefully this helps :slight_smile:

Does the string always start with “,”? if is so, try str = str.subString(1,str.Length())

Can you post the code you are using?


Used trimstart option. it didn;t work

Can you try TrimStart Method as the following?




1 Like