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 derfloh 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
Joined
Mar 15, 2005
Messages
450
Location
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)
 
cool!
I love learning all these tricks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top