Search code examples
rokubrightscript

How to do a 'stripslashes' equivalent in BrightScript


I'm new to Roku and finding that my JSON feed response looks something like this:

http:\/\/brightcove.vo.llnwd.net\/e1\/pd\/12345\/12345_1089831707001_test.mp4

Can anyone help me figure out how to fix the JSON response in BrightScript? I'm looking through the BrightScript reference document now, but just wanted to see if anyone knew of an easy way to do this while I continue to piece this together.

Thank you!


Solution

  • Well after a little more research I found the solution I needed. Incase this helps anyone else, here's the function I wrote to fix the strings:

    Function fixSlashes(item as string) As Object
    r = "\\" 'backslash character
    
    'case insensitive
     regexKeyFix = CreateObject( "roRegex", r, "i" )
    
        item = regexKeyFix.ReplaceAll( item, "" )
        Return item
    End Function
    

    And here's a link to the documentation I found for this.