Forum Discussion

OldMan63's avatar
OldMan63
Frequent Visitor
2 years ago
Solved

text.contains using beginning or ending spaces in text substring

Unclear how the Text.Contains function treats spaces within the text substring (e.g., "DR" vs. "DR " vs. " DR " vs. " DR"). Will it exactly match the sequence including spaces? If not, how can I do that?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Yes, Text.Contains treats spaces as text. So " DR", "DR", " DR ", and "DR " are not equal. However, each Text.Contains([FieldName], "DR" would = true for each of the above, but " DR " would = true only for " DR ".

     

    --Nate

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Yes, Text.Contains treats spaces as text. So " DR", "DR", " DR ", and "DR " are not equal. However, each Text.Contains([FieldName], "DR" would = true for each of the above, but " DR " would = true only for " DR ".

     

    --Nate

    • OldMan63's avatar
      OldMan63
      Frequent Visitor

      Thanks! That explains why I'm having the problem...not considering the characters before or after the substring. I'll split on all spaces and then do the check using equal operator. Reduces the purmutations to evaluate in a conditional.