For a String: Add "(" if it is missing

Hi

I have a string say Str. If it is missing “(”, I want to add in the 1st position of the string.

Is there a simple way to do it? Perhaps use formula or Regex?

Thanks

@Anonymous2 Check with this :
Str.Insert(0,"(")

To check if it is Missing and then Add :

if(Str.Substring(0,1).Contains("("),Str,Str.Insert(0,"("))

you can use if acitivty with “Not Str.Contains(”(")" in condition and in then block use assign activity with To value as “Str” and Value as Str.Insert(0,"(") or “(”+Str

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(Str,"^([^\(])","($1")

Regards,