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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional replace of first character in string

Status
Not open for further replies.

lorirobn

MIS
Mar 15, 2005
450
US
Hi,

How can I replace a semi-colon (;) only if it is the first character in my string? Sometimes it will be there, but not always.

Thanks in advance...
 
How about this?

If Left(yourString,1) = ";" Then
yourString = replacement & Right(yourString,Len(yourString)-1)
End If

-Pete
 
Excellent! Got it - thank you so much! Nice and simple, and it works, too.
Lori
 
maybe instead of Right(str, len(str)-1) you can use
mid( str, 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top