finding a character in a string

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf finding a character in a string

  • Creator
    Topic
  • #54465
    Hina Siddiqui
    Participant

      Hi guys,

      I am writing a tcl proc where i need find out if a string has “,” (comma) in it or not. If it does then i do a split function on the string(split based on comma).

      For example: if the input string is “X is good, Y is good”

      How can i find out if the above string contains the “,” character?

      Please provide some feedbacks.

      I have tries string compare, but it did not work.

      Thanks in advance 🙂

    Viewing 1 reply thread
    • Author
      Replies
      • #81598
        Jim Kosloskey
        Participant

          Hina,

          You can use the IF Xlate Action with the  contains (ct) operand to check to see if a string contains another string.

          Then inside that IF you can invoke your split proc.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #81599
          Hina Siddiqui
          Participant

            hey Jim, Thanks a lot. Its working now.

            I was getting an error “unrecognized lexical character” but this was because i was putting the character in the if condition like

            IF @strtemp eq =,

            then i assigend the comma to a variable and then used in IF condition and it started working. 🙂

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.