Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Replace problem

Hi, I tried to remove the < and > from a string with this self
written function. But even when the string contains < and > it won't
be replaced.

What is wrong?

Function unHTML(dezeString)
dezeString = Replace(dezeString,"<","<")
dezeString = Replace(dezeString,">",">")
dezeString = Replace(dezeString,"'","´")
unHTML = dezeString
End Function

strVoornaam = unHTML(Request.Form("Voornaam"))



for example: Voornaam = PETE
will still be: Voornaam = PETE
in case of: Voornaam = PETE
[hr]
[red]The 100[/red] best Dutch [blue]websites (free participation):[/blue]
:-) http://www.top100nederland.tk/

Comments

  • vanithvanith Member Posts: 44
    : Hi, I tried to remove the < and > from a string with this self
    : written function. But even when the string contains < and > it won't
    : be replaced.
    :
    : What is wrong?
    :
    : Function unHTML(dezeString)
    : dezeString = Replace(dezeString,"<","<")
    : dezeString = Replace(dezeString,">",">")
    : dezeString = Replace(dezeString,"'","´")
    : unHTML = dezeString
    : End Function
    :
    : strVoornaam = unHTML(Request.Form("Voornaam"))
    :
    :
    :
    : for example: Voornaam = PETE
    : will still be: Voornaam = PETE
    : in case of: Voornaam = PETE
    : [hr]
    : [red]The 100[/red] best Dutch [blue]websites (free participation):[/blue]
    : :-) http://www.top100nederland.tk/
    :

    Hi Roderick!

    Where are you checking the output of strVoornaam ?? If you check at the browser, it is going to repace < with the <. View the source of the HTML, your desired output should have been there. I dont see any problem with the function as such.

    :-) heers,
    Vanith
  • rodemmrodemm Member Posts: 44
    : : Hi, I tried to remove the < and > from a string with this self
    : : written function. But even when the string contains < and > it won't
    : : be replaced.
    : :
    : : What is wrong?
    : :
    : : Function unHTML(dezeString)
    : : dezeString = Replace(dezeString,"<","<")
    : : dezeString = Replace(dezeString,">",">")
    : : dezeString = Replace(dezeString,"'","´")
    : : unHTML = dezeString
    : : End Function
    : :
    : : strVoornaam = unHTML(Request.Form("Voornaam"))
    : :
    : :
    : :
    : : for example: Voornaam = PETE
    : : will still be: Voornaam = PETE
    : : in case of: Voornaam = PETE
    : : [hr]
    : : [red]The 100[/red] best Dutch [blue]websites (free participation):[/blue]
    : : :-) http://www.top100nederland.tk/
    : :
    :
    : Hi Roderick!
    :
    : Where are you checking the output of strVoornaam ?? If you check at the browser, it is going to repace < with the <. View the source of the HTML, your desired output should have been there. I dont see any problem with the function as such.
    :
    : :-) heers,
    : Vanith
    :
    Yes, you're right. I thought the textarea should show the &lt, but it showed <. The source was okay.
    [hr]
    [red]The 100[/red] best Dutch [blue]websites (free participation):[/blue]
    :-) http://www.top100nederland.tk/

  • vanithvanith Member Posts: 44
    : :
    : Yes, you're right. I thought the textarea should show the &lt, but it showed <%=Server.HTMLEncode(strVoornam)%>

    :)heers,
    Vanith


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ___ // http://forcoder.org // free ebooks and video tutorials about { MATLAB, Scratch, C, Java, Delphi, Visual Basic .NET, Visual Basic, Objective-C, Perl, R, PHP, Assembly, C#, Swift, JavaScript, C++, Go, Python, Ruby, PL/SQL Hack, Kotlin, F#, D, Ada, Clojure, Fortran, Julia, FoxPro, Scala, VBScript, Transact-SQL, Dart, Erlang, Awk, Logo, SAS, Rust, Lisp, Apex, Prolog, ML, Alice, COBOL, Scheme, ABAP, Bash, LabVIEW, Lua, Crystal } _________

Sign In or Register to comment.