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

Native Development

Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip
Accepted Solution

String compare/contains in QML ?

I need some function in QML for comparing strings or checking if some string begins with "http://". In c++ it's easy but in QML I have no idea how to do it Smiley Sad 

Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: String compare/contains in QML ?

Think of it as JavaScript (since that's what it is) and not QML. Any JavaScript tutorial or reference should cover such things, or you can search.

In this case, someString.substr(0, 7) == "http://" should be true if your string starts with that.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!