=James Birkholz= wrote, on Tuesday, July 08, 2003 9:54 AM
:  Is there a way to do an index function that is case-insensitive?

sub stripTagCaseInsensitive {
        my $startTag = lc($_[0]);
        my $endTag = lc($_[1]);
        my $contentCI = lc($content);
        while (index($contentCI, $startTag)>0) {
                my $first = substr($content, 0, index($contentCI, $startTag));
                my $last = substr($content, (index($contentCI, 
$endTag)+length($endTag)));
                $content = $first.$last;
                $contentCI = lc($content);
        }
}
  
stripTagCaseInsensitive("<FoNt",">");


But wouldn't it be easier to use a regex?

$content =~ s/\Q$startTag.*?$endTag//i; # untested!

Good luck,

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          574.243.6040 ext. 300    fax: 574.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
***** Please note that our Area Code has changed to 574! *****  




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to