Replace dont work within JS/QML

  • within my function i have

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

    dont work even when i try to use escape char


    basically i want to take my url variable and remove the http:// from it this works with js web like ( 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()@


Log in to reply

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