Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Subtraction?

Status
Not open for further replies.

robbaggio

Programmer
Jun 11, 2002
31
US
Say i have a string that is "/directory".
Is there anyway i can manipulate the string so i can create a new string that is "directory". So basically is it possible to remove a character from a string?

Thanks for the help

robbaggio

 
use the replace method

strSource = "/directory"
strFind = "/"
strReplace = ""

strNewString = replace(strSource, strFind, strReplace)

strNewString will be "directory"
 
Here you go

Private Sub Command1_Click()
Dim sDir As String

sDir = "/directory"
sDir = Mid$(sDir, 2)
Print sDir
End Sub

Hope this helps [flip]
If you choose to battle wits with the witless be prepared to lose.
[machinegun][ducky]
 
try var=instr(str,1,"\") -- this finds where the \ is, and then use mystr=right(str,len(str)-var), where mystr is the result string.
 
Use the (Replace Function)

newstr = Replace("/directory","/","")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top