Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    convert a string

    can anybody tell me how I can convert or translate a string that is taken from the user. for example when the user enter "abcdefghijkdeflmndefop" I want to read the string character by character and detect "def" anywhere in the string. and return "A" instead of that.

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use the Replace function to do this. Get your user's input from a form element and use it like this:

    <%
    strInput = Request.Form("form_fieldname_name_goes_here")
    strInput = Replace(strInput, "def", "A")
    Response.Write strInput
    %>
    As easy as 3.1415926535897932384626433832795028841

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <%
    Dim myString
    myString = "abcdefghijkdeflmndefop"
    myString = Replace(myString,"def","A")
    %>

    Please be more specific, though, you may want a regular expression function such as these:

    http://www.solidscripts.com/displayscript.asp?sid=10
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •