How to change the content in variable to empty text

Hi, how to change text in variable to empty text? :slight_smile: If the variable contains a given word, e.g. “black”, replace this variable with empty text.
Thank You.

Hi @sullivanne

modifiedText = originalText.Replace("black", "")

Cheers!!

1 Like

@sullivanne

Use assign with str_variable = String.Empty

Cheers

1 Like

Hi,

Can you try the following expression?

yourString = System.Text.RegularExpressions.Regex.Replace(yourString,"^[\s\S]*black[\s\S]*$","")

Regards,

1 Like

we can interpret this use case into direction

  • when, within the variable value a particular token occurs
  • then, set the entire variable value to empty string

assign Activity
yourStringVar = If(yourStringVar.Contains("black"), String.Empty, yourStringVar)

1 Like

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