|
-
May 30th, 2001, 11:12 AM
#1
Thread Starter
New Member
Replacin Spaces in a string
I am trying to do a database search on a name that I get from a vb text box. However I'm allowing users to put in a first and last name. In SQL I want the query to include '%John%Doe%'. How do I go about removing the space between John and Doe, and inserting the %?
-
May 30th, 2001, 11:20 AM
#2
Code:
sName = " John Doe "
Function FixIt(str as String) as String
Dim strName as string
strName = str
Do While Instr(strName, " ") > 0
strname = Replace(strName," "," ")
Loop
strName = Replace(strName," ","%")
FixIt = strName
End Function
-
May 30th, 2001, 11:21 AM
#3
Re: Replacin Spaces in a string
Originally posted by SuperChick
I am trying to do a database search on a name that I get from a vb text box. However I'm allowing users to put in a first and last name. In SQL I want the query to include '%John%Doe%'. How do I go about removing the space between John and Doe, and inserting the %?
using vb6:
String = "%" & replace("John Doe"," ","%") & "%"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|