GEOSoft Posted January 19, 2004 Share Posted January 19, 2004 (edited) I have to trim a string down until it only contains numeric digits. For ecample it may be (/A123456 and I would need only 123456 The following does not work. Do $b=StringLeft ($a,1) StringTrimLeft ($a,1) Until StringIsDigit($b)<>"0" What has to be done? Edited January 19, 2004 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 19, 2004 Administrators Share Posted January 19, 2004 $a = "ABC1234" While StringIsDigit( StringLeft($a, 1) ) = 0 $a = StringTrimLeft($a, 1) WEnd MsgBox(4096, "", $a) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
GEOSoft Posted January 20, 2004 Author Share Posted January 20, 2004 Thanks Jon. That worked just fine. I just repeated it for the Right end of the string so that now if they get carried away when selecting the number in the text file it will trim to the number only. I did not see the problem because EditPad handled a D-click to select process properly but NotePad (Yuk!!) would also select puctuation. For example with (123456), EditPad returned only the number while NotePad (Double Yuk!!) included the braces. That was quick too!! I barely had enough time to finish writing a novel. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
sconley Posted January 20, 2004 Share Posted January 20, 2004 (edited) How about $a = "A1B2C34D5Z" $b = "" for $I = 1 to StringLen($a) If StringIsDigit(StringMid($a,$i,1)) then $b = $b & StringMid($a,$i,1) Next msgbox(4096,"",$b) Edited January 20, 2004 by sconley Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now