Replace dont work within JS/QML



  • within my function i have

    @ var str = url // URL = http://some.website.com
    var n =str.replace("http:///","")@

    dont work even when i try to use escape char

    "http://"

    basically i want to take my url variable and remove the http:// from it this works with js web like (jsbin.com) but will not work on QML i get an error

    TypeError: Result of expression 'str.replace' [undefined] is not a function.



  • Hi,

    You should be able to get this working by changing the first line to:

    @var str = url.toString()@

    Regards,
    Michael


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.