Page1of1
command "print where" not case insensitive
Posted:Wed Dec 07, 2022 5:42 pm
byAzma
Hi,
print function seems to be case sensitive, does anybody know how to print a capitalized comment with case insensitive?
for example a rule with comment "ABCD", then print where comment "abc"?
thanks.
Re: command "print where" not case insensitive
Posted:Wed Dec 07, 2022 6:21 pm
byrextended
Make yourself a rule and follow it, so there's no need to screw things up.
印刷在哪里评论~”(|)(b | b) (c | c)”
This cover all 8 cases: abc abC aBc aBC Abc AbC ABc ABC
Re: command "print where" not case insensitive
Posted:Thu Dec 08, 2022 4:45 am
byAzma
Thanks, i was thingking regexp but just to confirm if i did it wrong.
I am sure that nobody want to use regexp to filter something.
Rules better to be implemented into software, human will never do it perfectly, But there must be a reason why they made it case sensitive.
Re: command "print where" not case insensitive
Posted:Thu Dec 08, 2022 9:26 am
bymkx
嗯,对我来说it's only natural to have things case-sensitive. Do 'a' and 'A' look the same? No, they don't, so why should they mean the same thing? Even in linguistic typing something in upper-case means (slightly) different than typing same in lower-case (the former is generally understood as shouting). In natural sciences and technical sciences upper-case letters and lower-case letters are very distinct. E.g. mJ stands formiliJoule while MJ stands forMegaJoule (Joule being unit of energy).
BTW, linux had always been case-sensitive, as were all the different Unix dialects preceeding it. Only MS f**ed up making things case-insensitive (another of their f**k-ups is reliance on file name extensions to identify file type).
From my point of view you should stop messing with different cases according to your daily inspiration and start using them in some coherent way ... and you won't need any regular expression or any other magic to filter output.
Re: command "print where" not case insensitive
Posted:Fri Dec 09, 2022 2:54 pm
byAzma
thanks for your input guys, i got your point.
Re: command "print where" not case insensitive
Posted:Fri Dec 09, 2022 5:36 pm
byrextended
for example a rule with comment "ABCD", then print where comment "abc"?
use this:
:global strfind do={ :local chrfind do={ :local chr $1 :if (([:typeof $chr] != "str") or ($chr = "")) do={ :return "" } :local ascii " !\"#\$%&'()*+,-./0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" :local conv "====E===EEEE==E================E=UUUUUUUUUUUUUUUUUUUUUUUUUUEEEE==LLLLLLLLLLLLLLLLLLLLLLLLLLEEE=" :local chrValue [:find $ascii [:pick $chr 0 1] -1] :if ([:typeof $chrValue] = "num") do={ :local nv [:pick $conv $chrValue ($chrValue + 1)] :if ($nv = "=") do={:return $chr} :if ($nv = "E") do={:return ("\\$chr")} :if ($nv = "U") do={:return ("($chr|$[:pick $ascii ($chrValue+32) ($chrValue+33)])")} :if ($nv = "L") do={:return ("($[:pick $ascii ($chrValue-32) ($chrValue-31)]|$chr)")} :return "." } else={ :return "." } } :local string $1 :if (([:typeof $string] != "str") or ($string = "")) do={ :return "" } :local lenstr [:len $string] :local constr "" :for pos from=0 to=($lenstr - 1) do={ :set constr "$constr$[$chrfind [:pick $string $pos ($pos + 1)]]" } :return $constr } print where comment~[$strfind ("abc")]