Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone
Accepted Solution

How to split a String

[ Edited ]

I have a string which is i am getting at runtime. its length is variable. Suppose its "NUMBER=ABC1004457844| This is the number you wanted". I want to get String between "=" and "|". It can be variable as i am getting it at runtime from server. This pattern is same in each response from server.

Please someone help. Its urgent.

Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800
My Carrier: idea

Re: How to split a String

Hi you can use the indexof and substring methods in this case, indexof method takes the character and returns the index of provided character, now give your required characters to indexof() alternately and get those indexes,now use the substring(startingIndex,endingIndex) for ur required string.
* Give kudos when you like it
* Mark it as a solution if it fixes your issue