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", "")


1 Like


Use assign with str_variable = String.Empty


1 Like


Can you try the following expression?

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


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.