Forum Discussion

jbrave's avatar
jbrave
Channel Surfer
16 years ago

no replace substring function?

I'm guessing either I'm missing something, or I need to somehow cook this up from scratch? Just want to replace spaces in a query with "+" or ","

- Joel

3 Replies

  • jbrave's avatar
    jbrave
    Channel Surfer
    Ah, I see, roRegex, huh? This should be in the String functions section maybe insted of it's own section?
  • "jbrave" wrote:
    Ah, I see, roRegex, huh? This should be in the String functions section maybe insted of it's own section?


    Yeah; I was in the middle of writing my own str_replace() function when I hit across that. I was stunned that such a basic tool was absent. Quite happy to find I was wrong. 😉
  • For querystring replacements, you can use the Escape/Unescape methods of the roUrlTransfer object:

    Function UrlEncode( query As String ) As String
    http = CreateObject( "roUrlTransfer" )
    Return http.Escape( query )
    End Function

    Function UrlDecode( query As String ) As String
    http = CreateObject( "roUrlTransfer" )
    Return http.Unescape( query )
    End Function