Re: Changing case of UTF-8 strings

2008-04-15 Thread Paulo Antonio
On 14 abr, 13:25, [EMAIL PROTECTED] (Chas. Owens) wrote: [...] Hmm, the following works for me, but then again I have export PERL_UNICODE=SDL #Make Perl use UTF-8 for IO in my .bash_profile. Yes, that made the trick. Thanks. But I wish there was a Perl only way... -- To unsubscribe,

Re: Changing case of UTF-8 strings

2008-04-15 Thread Chas. Owens
On Mon, Apr 14, 2008 at 1:21 PM, Paulo Antonio [EMAIL PROTECTED] wrote: On 14 abr, 13:25, [EMAIL PROTECTED] (Chas. Owens) wrote: [...] Hmm, the following works for me, but then again I have export PERL_UNICODE=SDL #Make Perl use UTF-8 for IO in my .bash_profile. Yes,

Changing case of UTF-8 strings

2008-04-14 Thread Paulo Antonio
Hi all, I'm trying to change case of UTF-8 strings. I've read a bunch of documentation, but can't figure out how to do it right. Here is an example: === My code: use strict; use utf8; my $line; my $letter; while ($line = STDIN) { chomp($line); utf8::upgrade($line); $line =

Re: Changing case of UTF-8 strings

2008-04-14 Thread Chas. Owens
On Apr 14, 2008, at 10:10, Paulo Antonio wrote: Hi all, I'm trying to change case of UTF-8 strings. I've read a bunch of documentation, but can't figure out how to do it right. Here is an example: === My code: use strict; use utf8; my $line; my $letter; while ($line = STDIN) {

Re: Changing case of the first letter of words in string

2003-08-26 Thread bis
--- zsdc [EMAIL PROTECTED] wrote: *Please* CC the mailing list when you answer. I'm writing it so everyone on the list could learn something, not just to fix your program or solve your particular problem. thanks for the reminder zsdc - i should have remembered to cc the list when

Re: Changing case of the first letter of words in string

2003-08-26 Thread zsdc
bis wrote: #!/usr/bin/perl -p s/(\s)(.)/$1\u$2/g if/SCTN:/; This capitalises the first letter of every word in the whole document. No, it doesn't. Only the lines containing SCTN: Have you run it? yes i have run it and below is the kind of output i get (original input all lower case except

Re: Changing case of the first letter of words in string

2003-08-23 Thread zsdc
James Edward Gray II wrote: On Friday, August 22, 2003, at 05:06 PM, bis wrote: Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; [...] Well, let's see if we can get a little closer: s/(SCTN:\s*)(.+)$/join '', $1, map { ucfirst $_ } split /( )/, $2/ge; See if that helps any.

Re: Changing case of the first letter of words in string

2003-08-23 Thread James Edward Gray II
On Saturday, August 23, 2003, at 02:34 AM, zsdc wrote: s/(SCTN:\s*)(.+)$/join '', $1, map { ucfirst $_ } split /( )/, $2/ge; See if that helps any. It gives a syntax error. Maybe try this: Sorry, I forgot to backwack those /. My fault for not testing the code. I'll try again:

Re: Changing case of the first letter of words in string

2003-08-23 Thread zsdc
*Please* CC the mailing list when you answer. I'm writing it so everyone on the list could learn something, not just to fix your program or solve your particular problem. bis wrote: Tnaks zsdc and JEGII. --- zsdc [EMAIL PROTECTED] wrote: It gives a syntax error. Maybe try this:

Changing case of the first letter of words in string

2003-08-22 Thread Bis
I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SCTN: as in SCTN: News

Re: Changing case of the first letter of words in string

2003-08-22 Thread Gabriel Cooper
Bis wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SCTN: as in SCTN:

Re: Changing case of the first letter of words in string

2003-08-22 Thread David K. Wall
Bis [EMAIL PROTECTED] wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string

Re: Changing case of the first letter of words in string

2003-08-22 Thread John W. Krahn
Bis wrote: I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do this for the whole document. But the string I want to match and operate on is all instances of text following the string SCTN:

Re: Changing case of the first letter of words in string

2003-08-22 Thread bis
Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; is an improvement - it does capitalise the first letter - but only of the first word after SCTN: so i get something like SCTN: This is a section name What I need is SCTN: This Is A Section Name hope that makes sense! :)

Re: Changing case of the first letter of words in string

2003-08-22 Thread James Edward Gray II
On Friday, August 22, 2003, at 05:06 PM, bis wrote: Thanks Gabriel - your suggested code s/(SCTN:\s*)(\w+)/$1\u$2\E/g; is an improvement - it does capitalise the first letter - but only of the first word after SCTN: so i get something like SCTN: This is a section name What I need is SCTN:

Re: changing case

2002-11-05 Thread dan
this *should* work:. __ START __ my $path = qq~/home/phisher/documents~; # set this to your path opendir(DIR,$path) or die(can't readdir $path: $!); # open the entire directory for getting the contents of while (my $file = readdir DIR) { # $file gets assigned the next value of DIR, and exits when

Re: changing case

2002-11-04 Thread dan
try this.. __ START __ my $path = qq~$HOME/documents~; # set this to your path opendir(DIR,$path) or diesub(can't readdir $path: $!); # open the entire directory for getting the contents of while (my $file = readdir DIR) { # $file gets assigned the next value of DIR, and exits when there's no

changing case

2002-11-03 Thread Desmond Coughlan
Hi, I'm trying to figure out how I can change the filenames in a directory, from having an initial capital letter, to all lowercase. The files came from a Windows system, which doesn't really care about case. My BSD box, however, does ! I've tried fiddling around with tr and lc, but I don't