[SOLVED] string endsWith in QML for url detection
-
wrote on 13 Jun 2012, 20:26 last edited by
i have tried to take a string like var urlString = http://rss.cbc.ca/lineup/canada.xml
how am i able to see if the urlString endsWith ".xml"
-
wrote on 14 Jun 2012, 05:43 last edited by
This should do: http://qt-project.org/doc/qt-4.8/qstring.html#endsWith
-
wrote on 14 Jun 2012, 05:53 last edited by
Actually, forget what I just said :-) Sorry. I think from within JS, you need to use regular expressions:
@
var endsWithXml = /xml$/;
if (endsWithXml.test(<filename>)) { ...}
@ -
wrote on 14 Jun 2012, 13:57 last edited by
Thanks I'll try that
-
wrote on 14 Jun 2012, 15:30 last edited by
Well i gave that a try and works perfect
thanks for your help
1/5