-
get leftmost or rightmost characters from a textfield?
I have a combobox component and I can grab it contents with cboBox.text But I really need to grab just the leftmost 2 characters or the rightmost 2 characters out of this text field, so I can use it elsewhere in my function.
I can't find any way to grab this, I tried using LEFT() but that doesn't work. Is this even possible?
Any help is greatly appreciated, thanks!
-
The String.substring method should do the trick ......
Returns a string comprising the characters between
the points specified by the start and end parameters.
mark
-
FlashCLUE.com
-
Ok, thanks! That worked, but it creates the substring as a string. This is fine, except I'm trying to put it into a Date variable.
So I have:
var time:String = mc.time.text //this is a combobox with times to choose (ex: 07:30 AM)
var mySubstring:String = time.substring(0,2); //this grabs the "07" from the time
But Now I need to compare this time to another time, so I'm trying to use the getTime() method:
var my_dateate = new Date(2004,4,15,mySubstring,0,0)
But I get an error on this b/c I'm trying to insert a string into where a number should be.
Ultimately, I'm trying to get a time so that I can compare it to another time. Any help is appreciated, thanks!!
-
FlashCLUE.com
-
Senior Member
Not to complaint, but why not direct people to the livedocs?
I believe people would learn more by themselves by learning to use the livedocs..
/Per-Henrik
-
FlashCLUE.com
it's simply easier 4 me but u can use your way, I don't care
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|