Add delimited value if it does not exist

Hello, someone who can help me
I want to add a unique value to a field, with different delimited values, if it does not exist, yes, I will send a text message that already exists
Example:

Dim a, b AS String 

a = TextField1.Text  // field values "1;2;3;"
b =  TextField2.Text // Case 1 or 5

// Look for a unique value delimited by;

If  a = b Then //  CASE 1
msg "it already exists" // TextField2.Text = 1;2;3;
else
msg "add value"
End if

If  a = b Then //  CASE 2
msg "it already exists"
else
msg "add value" // TextField2.Text = 1;2;3;5;
End if

Thanks

off the top of my head

if IndexOf(Split(a,";"),b)>0 then 

note : SPLIT has some issues in 64-Bit, but this gives you the idea

Is it the best way?


  TextField1.Text = "1,05,120"
  TextField2.Text = "1"

  Dim Words() As String
  Dim tempStr As String
  
  tempStr = ReplaceAll(TextField1.Text, " ","")
  Words = Split(tempStr, ",")
  
  If Words.IndexOf(TextField2.Text) < 0 Then
    MsgBox "does not exist"
  Else
    MsgBox "exists" // OK
  End if

the reported bugs about split in 64 bit have been fixed
<https://xojo.com/issue/40961>