View Full Version : Stripping Strings of Letters
iamapathy
April 26th, 2003, 09:44 PM
Is there a way to take all the letters out of a string and then use it as a integer?
If that is not possible, is there a way to take the first three letters off a string variable?
i.e. make myVariable='pic1' into myVariable = '1'
Yes? no?
ahmed
April 26th, 2003, 10:24 PM
myVariable = number(myVariable.charAt(3)) would do it :)
senocular
April 26th, 2003, 10:40 PM
also see:
http://proto.layer51.com/d.aspx?f=546
;)
ahmed
April 26th, 2003, 10:43 PM
nice protos you got there sen :)
iamapathy
April 27th, 2003, 01:12 AM
Thanks guys, I used ahmed's idea though, after some reading (i probably should have read the AS reference first), i found that what i really needed was the substring method, because some of my variable values were more that 4 digits, and the charAt only got the third character.
But Thanks, to both of you!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.