Welcome!

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

Reply
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

is StringPattern documented anywhere?

I'm going ahead with a home-brew database for a location based app and I'm implementing

some look up features. It looks like some of the Arrays classes will let me make various indicies

but I wanted to add more general look up capabilities.

I'd like to have something like a regex facility so a user can grep

the location point-of-interest cache for particular patterns. It sounds like StringPattern may be

close to a regex but I can't tell and don't have any examples handy. Anyone have comments on this?

 

 

 

Thanks.

 

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: is StringPattern documented anywhere?

$ grep -Ril StringPattern *
com/rim/samples/device/activetextfields/ActiveTextFields.java
com/rim/samples/device/activetextfields/activetextfieldsdemo.cod
com/rim/samples/device/activetextfields/activetextfieldsdemo.jad

ok, I guess this helps but still not sure where to get more complete info- just the one example?

 

ApplicationDescriptor appDesc = new ApplicationDescriptor(ApplicationDescriptor.currentApplicationDescriptor(),"Active Text Fields",new String[]{"pattern-recognized"});
                PatternRepository.addPattern(appDesc,"[0-9]{9}",PatternRepository.PATTERN_TYPE_REGULAR_EXPRESSION,_menuItems);           
            }

Developer
Posts: 16,987
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: is StringPattern documented anywhere?

marchywka are you answering posts in person or is it a script running grep? Smiley Wink
anyhow, good idea, doing it myself now Smiley Happy

net.rim.device.api.util.StringPattern is the class, but how to exactly use it, no clue, never tried.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
BlackBerry Development Advisor
Posts: 15,700
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: is StringPattern documented anywhere?

You can find an example and documentation for it here:

 

How to - Leverage pattern matching in BlackBerry smartphone applications to provide an integrated user experience
Article Number: DB-00525

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker