@replace works case sensitive

Aug 2, 2011
258
4
Berlin, Germany
Yesterday I became almost desperate because @replacing strings did not work (as expected).
I was really doubtful about my mind - until I RTFM.
Of course @replace works case sensitive, but what I want to ask:
Is there a way to bypass this or
perhaps the possibility to enhance @replace with a "case insensitive - switch"?
 
Sep 11, 2012
100
1
Perhaps a function linke this ?

ireplace=%@replace[%1,%2,%@upper[%3]]

Test:

echo %@ireplace[ABC,abc,"Test AbC"]

Result: Test abc

echo %@ireplace[ABC,abc,"Test abC"]
Result: Test abc
Is that your goal ?
 
Sep 11, 2012
100
1
Perhaps a function like this ?
ireplace=%@replace[%1,%2,%@upper[%3]]
Test:
echo %@ireplace[ABC,abc,"Test AbC"]
Result: Test abc
echo %@ireplace[ABC,abc,"Test abC"]
Result: Test abc
Is that your goal ?
 
Aug 2, 2011
258
4
Berlin, Germany
Hello Stein,

that's a cool idea and actually what I want. It would also work with tcc/le without functions if I "upper" the 3rd parameter before the @replace. Thank you.

But even more elegant would be an "ignore case" switch. ;)
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
I how to make TCC default/replace cmd.exe? Support 9
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
T @replace -- what is wrong here Support 2
C Replace 1st argument on command line Support 4
R How to? Replace in Rename Support 9
C How to? @replace[a comma,_,filename] Support 5
MickeyF Can't get my TPIPE /replace to work Support 4
C @replace and @xreplace problems Support 5
C How to? Replace &'s in filenames / FixNames.dll Support 2
M I'm unable to use @replace[] with a % character in string2 Support 12
MikeBaas Strange prob with %@replace.. Support 4
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
J @replace weirdness Support 1
vefatica TPIPE /replace? Support 3
Stefano Piccardi replace tcc process space? Support 8
vefatica @SUBST ... how replace character with a caret? Support 9
mdwyer @replace - global use in a text file Support 3
B Regex and Replace Support 6
B REPLACE is good news Support 0
J Problem with %var:find=replace% syntax Support 5
T VIEW only works from command line Support 14
D Alias with setdos no longer works Support 21
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
Phileosophos Enumshares works sometimes Support 16
I findstr works in cmd but not in tcc Support 5
Dmitry L. Kobyakov WAD Start /pgm "name.htm" works improperly Support 4
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
Joe Caverly Works in debugger, not from cmd line Support 1
M "less" program that works in TC 18 Support 12
Joe Caverly Echo message works without the space? Support 3
cxxl dir /s works in mysterious ways :( Support 4
J WAD setarray "/f" only works on first one Support 1
M Console-Mode (*.exe) works in TCC, not in TCMD Support 2
redwdc btm won't run in ver. 17 but works in ver. 16 Support 11
I How to? Bat Works but BTM Doesn't Support 6
vefatica Alias works differenltly v16 vs. v17 Support 13
C FFind /w works but FFind /= doesn't? Support 2
R Drag to BTM no longer works in Windows 8.1 Support 10
D TPIPE works without being in path, but not V; aemail Support 8
noahcoad c:/hello.txt works in cmd.exe but not tcc.exe Support 1
C .bat files works in cmd.exe, not in TCMD Support 6
K Ctrl-D alias no longer works Support 4
R %+ works differently after upgrade Support 3
Joe Caverly Clearing a section of the screen works in CMD, not in TC Support 2
F WAD SWITCH statement with regexes or wildcards as CASE expressions Support 9
nikbackm Switch Case and here-document redirection Support 2
M How to? Set the ribbon titles to mixed case Support 1
vefatica WAD Escaping changes case to lower? Support 12

Similar threads