BSM Connector String Function getToken() is unable to split Pipe delimited strings (584 Views)
Reply
Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 1 of 6 (584 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

HP Expert
PatWest
Posts: 832
Registered: ‎03-06-2008
Message 2 of 6 (557 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
Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 3 of 6 (556 Views)

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

Thanks,

 

the case is already open since yesterday...

 

Regards

Roland

Acclaimed Contributor
Dennis Handly
Posts: 25,049
Registered: ‎03-06-2006
Message 4 of 6 (541 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?

Frequent Advisor
Roland Koetting
Posts: 29
Registered: ‎10-05-2004
Message 5 of 6 (533 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

Acclaimed Contributor
Dennis Handly
Posts: 25,049
Registered: ‎03-06-2006
Message 6 of 6 (506 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.

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.