Sign in to follow this  
Followers 0
GEOSoft

Do.....Until

4 posts in this topic

#1 ·  Posted (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 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!"

Share this post


Link to post
Share on other sites



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. :whistle:


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!"

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by sconley

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0