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

Remove 3 leading leters from a variable

Status
Not open for further replies.

Blakeseven

Technical User
Nov 17, 2002
21
US
I have a var with that contains something like this : f:\temp\testI want to strip the first 3 letters so the var looks like this : temp\test

How can I do this in JS

Thanks for the help....

Ben
 
str = "f:\temp\test\"

newStr = str.subStr(2)

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Maybe this...

newStr = str.substring(2)

Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
oopps typo

str = "f:\temp\test\"

newStr = str.substr(2)

or as adam101 says

newStr = str.substring(2)

both work



Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Of course if you tried to run the code the way it is, you'd get an error because it would think the back-slashes are escaping the end quote. But I'm guessing Blakeseven has already accounted for that. If not, you can escape the back-slashes like this:
str="f:\\temp\\test\\"
str=str.substring(3)

Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
Well I tried all the above and get this erroe message " Object doesn't support thei objext or method"

Any Ideas
thanks again

Ben
 
Can you post your code?

Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top