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

javascript version of vbscript's left() 1

Status
Not open for further replies.

sezme

Programmer
Oct 31, 2003
26
0
0
GB
any ideas
 
myStr = "ABCDEFG"
myStr.substr(0,3) = "ABC"

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 (No, I'm not Rick)

fart.gif
 

If you actually want a left() function you could make one like this:

Code:
function Left(str, num){
        
    return s.substring(0, num);
}
 
Technical note...

myStr = "ABCDEFG"
myStr.substr(0,3) = "ABC"
myStr.substring(0,3) = "ABCD"

.substr(start,length)
.substring(from,to)




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 (No, I'm not Rick)

fart.gif
 

thanks - as always mwolf00 a great help

you've got a star - cos sometimes it dont quite seem worth it - but they all add up
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top