Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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