Search found 88 matches

by sst
22 Nov 2020 16:42
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

Here is an interactive version of the script with the applied suggestion by Eureka! Please note that SET /P strips the trailing TABs from user input. So the case for trailing TABs can not be tested with this interactive version. (At least that's the case on my Win7 x64) EDIT: Trailing TABs can be te...
by sst
22 Nov 2020 16:09
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

Unfortunately this one doesn't work as it is, if the first part of the string contains = or ! The case for ! can be resolved easily, but = is tough. As a side note you should use something like "#%TEMPSTRING%#" in FOR /F to protect the leading and trailing TABs. The reason for protecting the leading...
by sst
22 Nov 2020 14:15
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

Thanks Eureka!. It is much better now.
Getting rid of :strlen was my primary concern. Now I'm relieved :D
by sst
22 Nov 2020 12:08
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

Nope. I removed spaces as a temporary means of performing the TAB detection and obtaining the TAB character.
My code preserves the spaces while removing/replacing the TABs in the original string. Your's does not.
So it is not only a matter of simplification.
by sst
22 Nov 2020 11:16
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

Based on what I understand this may be an easier solution for you. @echo off setlocal SET "tabstg=Some String with tabs" SET /P "repl=Enter Replacement String or {enter} for none:" :LOOP FOR /F "tokens=1*" %%G IN ("%tabstg%") DO ( IF NOT "%%H"=="" ( SET "tabstg=%%G%repl%%%H" GOTO LOOP ) ) echo Stri...
by sst
22 Nov 2020 11:12
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

I didn't say that. And the spaces are not a problem. But I think It should be obvious by know. Well maybe I don't understand the English Language but you certainly inferred that with your REM comments. :: Remove all Spaces :: ... set "testTAB=#!String: =!#" REM The default delimiters are <SPACE> an...
by sst
22 Nov 2020 06:12
Forum: DOS Batch Forum
Topic: Limited number of CALLs per line?
Replies: 4
Views: 1062

Re: Limited number of CALLs per line?

Adding the one more CALL :SUB to the line causes the last :SUB on the line to be recognized as a valid batch label so the next line will executed in the context of the :SUB function. @echo off call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB & call :SUB &...
by sst
22 Nov 2020 03:31
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Re: Detecting and removing TABs from a string without prior access to the TAB character

But why go through all that extra code to remove the tab by getting the string length. You already have the TAB removed with the FOR /F command. And what if your string has multiple tabs???? FOR /F can not be used to remove the TABs from the string because as you said the string can contain multipl...
by sst
21 Nov 2020 13:49
Forum: DOS Batch Forum
Topic: Detecting and removing TABs from a string without prior access to the TAB character
Replies: 14
Views: 1492

Detecting and removing TABs from a string without prior access to the TAB character

Detecting and/or removing the TAB characters from a string is a fairly simple task, define the TAB character using one of many available methods and do a substitution !string:%TAB%=! But I was looking a way to detect and possibly remove or substitute the TAB characters without resorting to any exter...
by sst
15 Sep 2019 18:14
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

I'm not sure if you misunderstood what i had written and use a different definition of "different parsers", or if there really are multiple different parsers - both could be what you describe (depending on how you mean it). From my usage of "different parsers", the interpreter would for example has...
by sst
13 Sep 2019 18:24
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

I mean... what is unclear to me is, that i don't get why MS seems to have built a parser, that behaves differently depending on the command token, when splitting the command and argument string: If the expected output of "REM One^\r\n Two^ Three^\r\n This is the comment\r\n" is the (command, argume...
by sst
08 Sep 2019 05:28
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

Now, I understand why the REM trick to gather the arguments works so good, and why it fails with multiline input. The REM parser will read the first token(GeToken) and compares it against "/?". If the token is "/?" it sets the help flag to true else it ungets the token(UnGeToken) and do a second Ge...
by sst
06 Sep 2019 08:15
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

I stumbled upon this old post of mine, and I just realized the last behavior is identical to REM :shock: :!: If there is only one following token ending with escape and end of line, then the token is thrown away. This repeats until there is more than one token on the line, or the line doesn't end w...
by sst
06 Sep 2019 00:02
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

It's interesting, that this list doesn't contain the escape operator (the circumflex accent character: '^'). That raises the question, if you used something like IDA, where you see all code, or if you just traced the program flow. The first option would be nice, beacause then it could be possible t...
by sst
02 Sep 2019 08:10
Forum: DOS Batch Forum
Topic: Closing parenthesis prevents escape of subsequent special character operator
Replies: 33
Views: 20786

Re: Closing parenthesis prevents escape of subsequent special character operator

I am not able to escape a special character operator token if it appears immediately after a closing parenthesis. Not sure how this is useful, but I find it interesting. I would expect the escaped forms to generate a syntax error, but rather the "escaped" operator is fully functional :!: Anyone hav...