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!

Custom Trim Function 1

Status
Not open for further replies.

jw5107

Technical User
Jan 20, 2004
294
US
I have values in a field that show - for example -like this:
M-2030-5734-C
A300-3440-12405-F
M-3130-13005-I

I need to update the values in this field to show like this:
5734
12405
13005

Basically from the left 2 "-" (dash marks) and then from the right, the 1st "-"

Don't know how to format the proper syntax for this!!
Any suggestions or examples?

Thanks in advance!!
jw
 
something like this, may be there is a better way...but you will get an idea...

Code:
mystring="M-2030-5734-C"
mystring=Right(mystring,len(mystring)-instr(mystring,"-"))
mystring=Right(mystring,len(mystring)-instr(mystring,"-"))
mystring=left(mystring,instr(mystring,"-")-1)
response.write mystring

-DNG
 
DotNetGnat,

Thanks!!

I took your example and worked it out!!

Thanks!!
jw
Smack down with a star ferya!!!
 
Another way:
newField = Split(oldField, "-")(2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top