Microsoft
Software
Hardware
Network
Question : Removing numbers after underscore
I am currently using the following to take off the last 3 characters of a string:
<%=left(RSorder.Fields.Ite
m("orderSp
ec").Value
, len(RSorder.Fields.Item("o
rderSpec")
.Value)-3)
%>
This turns this Oven Filler Long Grain345 into this Oven Filler Long Grain.
It has now come to my attention that their maybe more than 3 numbers at the end of a string so this isn't the ideal solution.
I would like it so that I could have the string originally appear as Oven Filler Long Grain_345 and no matter how many numbers follow it, everything after the underscore is removed.
I also need to be able to access the number after the underscore as a separate variable.
Is this possible?
Thanks,
Chris
Answer : Removing numbers after underscore
s = "Oven Filler Long Grain_345"
s1 = Left(s, InStrRev("_" & s, "_") -1)
s2 = Mid(s, Len(s1) +1)
Random Solutions
Send/receive mails in Exchange 2010
How to undelete public folder content on MS Exchange Server 2000
user rights and administrative rights problems on domain
using window.open want to get rid of url bar in new window within IE7
error SQL3126N when loading data from local file to remote DB2 instance
Inserting image in Word 2007 table
SBS 2008 shared folder permissions problem - read only - need full control
Installing MAPI CDO on Exchange 2007
Calendar Control in Excel 2003 VBA
Server 2008 R2 DC File Permissions