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")
02-13-2003, 02:15 AM
myString = "abcdefghijkdeflmndefop"
myString = Replace(myString,"def","A")
Please be more specific, though, you may want a regular expression function such as these:
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.