BSM Connector String Function getToken() is unable to split Pipe delimited strings (272 Views)
Reply
Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 1 of 6 (272 Views)
Accepted Solution

BSM Connector String Function getToken() is unable to split Pipe delimited strings

[ Edited ]

Hi all,

 

I am using BSM Connector 9.23 on Windows:

I have to split a string which is delimited with pipe characters with the function
getToken(string,delimiter,index).

 

Example not working: 
  getToken("zero|one|two","|",1)  -> Returns "z" (not correct)

An underscore-delimited string is working:

Example working:
  getToken("zero_one_two","_",1)  -> Returns "one" (correct)

All my ideas to escape/quote the pipe character (which is an operator) are not working...

 

Thanks and Best Regards

Roland

Please use plain text.
HP Expert
PatWest
Posts: 817
Registered: ‎03-06-2008
Message 2 of 6 (245 Views)

Re: BSM Connector String Function getToken() is unable to split Pipe delimited strings

Hi Roland,

Open up a support case, this is something for R&D to look at.

PatW
Please use plain text.
Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 3 of 6 (244 Views)

Re: BSM Connector String Function getToken() is unable to split Pipe delimited strings

Thanks,

 

the case is already open since yesterday...

 

Regards

Roland

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,757
Registered: ‎03-06-2006
Message 4 of 6 (229 Views)

Re: BSM Connector String Function getToken() is unable to split Pipe delimited strings

[ Edited ]

>I have to split a string which is delimited with "|" with the function: getToken(string,delimiter,index).

 

What are the specifications of delimiter?  Is it a simple char or string?  Or is it an ERE where a "|" is a metacharacter and would need quoting?

 

>my ideas to escape/quote the pipe character

 

What did you use?

Please use plain text.
Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 5 of 6 (221 Views)

Re: BSM Connector String Function getToken() is unable to split Pipe delimited strings

[ Edited ]

Here is the solution:

 

It is not possible to quote the Pipe character with backslash(es) -

but it is possible to express a list of (here one) delimiter character which does not need quoting:

 

getToken("zero|one|two","[|]",1) -> Returns "one" (correct)

 

Regards

Roland

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,757
Registered: ‎03-06-2006
Message 6 of 6 (194 Views)

Re: BSM Connector String Function getToken() is unable to split Pipe delimited strings

>It is not possible to quote the Pipe character with backslash(es) -

 

Hmm, and this doesn't work?  "\\|"

Glad you found a solution.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation