$countcs() - 10/05/03 07:51 PM
Since there are already case-sensitive versions for $remove and $replace, it would be nice if one existed for $count.
alias countcs { /set -u0 %count 0 /set -u0 %l 1 while (%l <= $len($1)) { if ($2 isincs $mid($1, %l, 1)) { /inc -u0 %count } /inc -u0 %l } return %count }
alias countcs { var %c = 0, %i = 2, %p while %i <= $0 { !.echo -q $regsub($($ $+ %i,2),/([\.\(\)\{\}\+\*\?\[\]])/g,\\\1,%p) var %c = %c + $regex($1,$+(/,%p,/g)), %i = %i + 1 } return %c }