View Full Version : convert a string

02-12-2003, 04:40 PM
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.

02-12-2003, 05:30 PM
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

02-13-2003, 02:15 AM
Dim myString
myString = "abcdefghijkdeflmndefop"
myString = Replace(myString,"def","A")

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