How to remove the character from the string by keeping the 1st occurrence only

Hi,

This is the input string “foo bar foo $ bar $ foo bar $”
How to remove the “$” sign by keeping the 1st occurrence

Expected output should be: “foo bar foo $ bar foo bar”

Hi @Shirin_Sebatina

String.Join(“ “, Split(“foo bar foo $ bar $ foo bar $”.ToString, “$”).Skip(1))

Regards
Gokul

Hi

Hope the below expression would help you resolve this

Use a assign activity like this

stroutput = Split(Strinput.ToString, “$”)(0).ToString+” “+”$”+” “+String.Join(“ “, Split(Strinput.ToString, “$”).Skip(1))

Cheers @Shirin_Sebatina

Hi @Shirin_Sebatina ,

Could you try this?

String.Join("",str_variable.Split({"$"},StringSplitOptions.RemoveEmptyEntries).Skip(1))

Kind Regards,
Ashwin A.K

Hi,

Another solution:

yourString.Remove(yourString.IndexOf("$"),1)

Regards,

1 Like

Thankyou!!!

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