Forum Discussion

mcbootus's avatar
mcbootus
Contributor
15 years ago

Using split with a non recognised character

Dear Support,

I am using the split command to parse various data but on this occassion SoapUI does not recognise the correct character and hence doesn't split correctly.

Here is the value I want to split :

BUDG/A1/799689|budg



I want to split using the "|" and pick up the code after the "|" - im using these commands:



longcode = "BUDG/A1/799689|budg"

parser = longcode.split("|")

shortcode = parser[1]




Any help would be greatly appreciated!

Armen

2 Replies

  • Hi Armen,

    split takes a regular expression, so you will need to escape the '|', try splitting with

    longcode.split( "\\|" )

    Does that help?

    regards,

    /Ole
    eviware.com
  • Dear Ole,

    Thank you for the information - that worked perfectly!

    Best regards,
    Armen