home bbs files messages ]

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,777 of 68,980   
   Tom Del Rosso to All   
   Re: Get String Length   
   03 Sep 21 03:07:18   
   
   From: fizzbintuesday@that-google-mail-domain.com   
      
   JJ wrote:   
   > On Thu, 2 Sep 2021 03:08:01 -0400, Tom Del Rosso wrote:   
   >>   
   >> What does HasStr do? Find a substring?   
   >   
   > Yes. A sub to check the existence of a substring when the index of the   
   > substring doesn't matter. It's basically just a sub which finds the   
   > index of a substring.   
      
   So you're thinking of doing it this way?   
      
      
   @echo off   
   set string=Where is the substring?   
   set substring=the   
      
   call set poststring=%%string:*%substring%=%%   
      
   call :GetStringLength string   
   set /a string_len = StringLength   
   call :GetStringLength substring   
   set /a substring_len = StringLength   
   call :GetStringLength poststring   
   set /a poststring_len = StringLength   
      
   set /a position = string_len - substring_len - poststring_len   
      
   echo %string%   
   echo %substring%   
   if %poststring_len% LSS %string_len% echo Has string after position   
   %position%.   
      
   pause   
   goto :eof   
      
   --   
    Defund the Thought Police   
      
   --- 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