How to remove part of a string
Hi all,
I was wondering how I could remove part of a string that is on the right of a slash (/).
For example:
Before - aldsjkfj/ksjldf
After - aldsjkfj/
Thanks Jobartley515
# 1 Re: How to remove part of a string
dim k as long
k = instr(myString,"/")
if k > 0 then newString = left$(myString, k-1)
mstraf at 2007-11-11 17:25:05 >

# 2 Re: How to remove part of a string
Although, jobartley515 wanted to keep the "/" so :
if k > 0 then newString = left$(myString, k)
;-)
gupex at 2007-11-11 17:26:05 >

# 4 Re: How to remove part of a string
Hi,
Thanks for your responses.
They help me to a point, but I was wondering if you could help me again.
I wish to remove part of the string to the right of the last "/" slash in the string.
Before:
asdfasdf/asdfasdfasdf/asdfasdfasdf
After:
asdfasdf/asdfasdfasdf/
Again thanks for your help.
Jobartley
# 5 Re: How to remove part of a string
Use the original code with InstrRev instead of Instr.
dim k as long
k = InStrRev(myString,"/")
if k > 0 then newString = left$(myString, k)
Steve.