0

I have a quick question in regards to using .Contains(). I'm writing an if statement and need to update a text field if it contains "VA". However, if it contains "IVA" it shouldn't update this field. What would be the best way to make sure I capture anything with "VA" except for "IVA"?

2
  • what if text looks like abcVALUE -- match or no match?
    – cropredy
    Commented Dec 17, 2020 at 19:10
  • match. it just cannot be iVALUE
    – verycold
    Commented Dec 17, 2020 at 19:19

1 Answer 1

1

You could do this with regex but a simple solution is:

if (myString.contains('VA') && !myString.contains('IVA')) {
    ... do field update
 }
1
  • thank you! knew it was something simple but couldn't figure it out lol
    – verycold
    Commented Dec 17, 2020 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .