BW> No, no error, and '/a' is what I meant, but I think you're right. A
BW> compiler should post an error or at least a warning, IMHO. I started
BW> using two char constants a couple years ago, not realizing it was a bad
BW> idea, and not at all portable evidently... Now I'd like to rewrite all
BW> the code that uses this type, and I'm looking for the best way.
in Perl language,
while () { print if /'..+'/; }
will find all of your '' pairs with 2 chars or more in them...
the pattern should be a little more elaborate because it currently
doesn't care for cases where you got two ' pairs on the same line, and
will match the second and third, and doesn't handle comments, but it's
probably much better than just searching for single apostrophes :-)
incidentally, it's even shorter in awk language:
/'..+'/ { print }
and even shorter in sed language, though i don't remember the syntax.
Since both Perl and Awk are much influenced by C/C++ syntax (at least
at a larger scale than this problem), this is about 40% on topic :-)
Also, you can use Grep, either the GNU one or the Turbo (Borland) one
that comes with every TC or BC.
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)
|