Jump to content



Photo

Do.....Until


  • Please log in to reply
3 replies to this topic

#1 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,563 posts

Posted 19 January 2004 - 11:45 PM

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, 19 January 2004 - 11:47 PM.

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







#2 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 9,529 posts

Posted 19 January 2004 - 11:49 PM

$a = "ABC1234" While StringIsDigit( StringLeft($a, 1) ) = 0   $a = StringTrimLeft($a, 1) WEnd MsgBox(4096, "", $a)


#3 GEOSoft

GEOSoft

    Sure I'm senile. What's your excuse?

  • MVPs
  • 10,563 posts

Posted 20 January 2004 - 12:16 AM

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

#4 sconley

sconley

    Wayfarer

  • Active Members
  • Pip
  • 77 posts

Posted 20 January 2004 - 03:36 AM

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, 20 January 2004 - 03:38 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users