Application Perf Mgmt (BAC / BSM) Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

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

SOLVED
Go to Solution
Highlighted
Frequent Advisor

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

5 REPLIES
HPE Expert

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

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 Acclaimed Contributor

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

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