Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,550 of 68,980    |
|    probyn@berkeley.edu to Robert Prins    |
|    Re: Remove all but digits    |
|    25 May 20 23:30:02    |
      On Monday, May 25, 2020 at 12:01:39 PM UTC-7, Robert Prins wrote:       > On 2020-05-22 14:30, Tom Del Rosso wrote:       > > The objective is to remove everything except digits 0-9 from a string.       > >       > > %alpha_substrings% does contain all possible non-numeric substrings       > > (space separated), so this should remove them and leave only the digits.       > >       > > set "only_numbers=string"       > > for %%t in (%alpha_substrings%) do (       > > call set "only_numbers=%%only_numbers:%%t= %%"       > > )       > >       > > But some characters in the non-numeric substrings, like =, don't get       > > removed because they are never included in %%t.       > >       > > If FOR/F is used then it includes those characters because they are not       > > seen as delimiters, but it doesn't spit them out one at a time in       > > multiple loops.       > >       > > I'm tempted to use GWBASIC (MS just made it open-source!).       >       > If all you have is a hammer, everything looks like a nail!       >       > Use REXX, available for about every OS, it makes the solution almost trivial.       >       > Robert       > --       > Robert AH Prins       > robert(a)prino(d)org       > The hitchhiking grandfather - https://prino.neocities.org/indez.html       > Some REXX code for use on z/OS - https://prino.neocities.org/z       S/zOS-Tools.html              Of course REXX is far superior. I have lots of 'utility' programs that I have       written using Regina REXX in Windows. But the point here is to only use what       comes 'built-in' with Windows to get the job done.              Phil Robyn       U.C. Berkeley (retired)              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca