Trimming Characters

alan04

New member
Local time
Tomorrow, 00:12
Joined
Dec 31, 2005
Messages
1
My students reg numbers are written as 01/2007, 101/07 and 1/07. How to trim the numbers to get the numbers left to the sign / only.
 
My students reg numbers are written as 01/2007, 101/07 and 1/07. How to trim the numbers to get the numbers left to the sign / only.

tgtNum = Left(regNum, 1, InStr(regNum,"/"))
 
Search for Parsing on the forum! you should be able to find an answer there

Edit: Or someone will tell you!:D
 
tgtNum = Left(regNum, 1, InStr(regNum,"/"))
This almost works for me as well. I had to change it to tgtNum=left(regnum, instr(regnum,"/")) but it returns the "/" as well. is there a way to omit that?
 
from the debug (immediate) window:
Code:
regnum = "101/07"
tgtNum=left(regnum, instr(regnum,"/")-1)
? tgtNum
101
 
For the fun of it, here's another one

MsgBox Split("01/2007", "/")(0)

Is there any possibility that there is no "/" in the string?
 

Users who are viewing this thread

Back
Top Bottom