Application Perf Mgmt (BAC / BSM) Practitioners Forum
cancel

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

SOLVED
Go to solution
Roland Koetting
Respected Contributor.

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

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

5 REPLIES
PatWest
Acclaimed Contributor.

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
Roland Koetting
Respected Contributor.

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

Thanks,

 

the case is already open since yesterday...

 

Regards

Roland

Dennis Handly
Acclaimed Contributor.

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

>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?

Highlighted
Roland Koetting
Respected Contributor.
Solution

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

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

Dennis Handly
Acclaimed Contributor.

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.