downcase part of a string

M

Martin DeMello

Prettier regexp, paid for with two more steps:

msg = "THIS is a Text and (NO Change HERE) HELP (Not here Either)"

(")"+msg+"(").gsub(/\)(.*?)\(/) {|i| i.downcase}[1..-2]

martin

Certainly not pretty with that funky regex, but it works:

msg = "THIS is a Text and (NO Change HERE) HELP (Not here Either)"

msg.gsub!(/([^\(]*(?!\())|(\(.*?\))|(\)[^\)]*\))/) do |m|
m[0] == 40 ? m : m.downcase
end

- Scott
hi,
I want to downcase a string but without specific parts.
for example:
msg = "THIS is a Text and (NO Change HERE) HELP"

after downcase it should look like "this is a text and (NO Change HERE)
help"

I don't want to downcase the letters in parentheses.
How can i do that, i tried it with regular expressions but can't do
it.

Thanks for any help
 
A

Austin Ziegler

That's the way I remember it -- he said that a lowercase accented
character was sometimes uppercased differently, and it varied
"from district to district."

The wording was actually "jurisdiction to jurisdiction." This actually
matters, because it really deals with major jurisdictions, like Qu=E9bec
and Vietnam and Surinam and Algeria and=85
Earlier tonight I think he mentioned Quebec (but with a proper accent
that I don't know how to type).

Look at AllCaps, Hal. Then you'd do Ctrl, ', e (three separate
keypresses, so not Ctrl-') to get =E9. Or do like me: get a Mac
(Option-e, e). ;)
I wouldn't be surprised if the French sometimes sneered a little at
the French spoken in Quebec, the way (sometimes) Brits make fun of
Americans, or Spanish (or Colombians) make fun of Mexicans.

They do. Sometimes it's absolutely awful. Although, it's much more
like how (American) Northerners pick on (American) Southern drawls. If
you have a chance to listen to a Qu=E9becois French speaker, listen
carefully. You'll hear a bit of a twang like you would in the American
south. Funnily enough, it's for similar reasons. The American north
was settled first and most often, and had the biggest blending of
language and dialect. The south, on the other hand, was settled a
little later and ended up being a bit more sparsely populated and with
fewer non-English speakers. So the old English speaking habits hung on
a little longer and were a bit more isolated.

The Qu=E9becois were separated from France at the time of the Seven
Years' War=97what Americans would call the French and Indian War. The
French immigrants of the time were taught in an =E9cole system that was
headed by the priests, who by and large spoke court French. When
France lost all of Canada to England, the priests and nobles went back
to France, rather than subjecting themselves to English rule. A mere
thirty years later, most of them lost their heads and the French
revolutionaries established schools=85that taught the French that they
knew. In other words, the French spoken after the revolution was
mostly the French of the streets and of the salons, not royal French.
From that point forward, the French spoken by the European French and
the Qu=E9becois diverged some.

-austin
--=20
Austin Ziegler * (e-mail address removed) * http://www.halostatue.ca/
* (e-mail address removed) * http://www.halostatue.ca/feed/
* (e-mail address removed)
 
H

Hal Fulton

Tim said:
Hal: your book is too thick, it hurts my wrists. But I'll try. -Tim

Ha... but chapter 4 is rather thin.

Maybe you can attack someone else's copy with an X-acto knife...
someone who doesn't want to internationalize anyhow.


Hal
 
H

Hal Fulton

Austin said:
The wording was actually "jurisdiction to jurisdiction." This actually
matters, because it really deals with major jurisdictions, like Québec
and Vietnam and Surinam and Algeria and…

My memory may be faulty, but I really thought he said "district."
Not that it matters really. Was it recorded?

[snip other interesting stuff, which reminds me a little of _Wayne's
World_ where Alice Cooper gives the history lesson]


Hal
 
A

Austin Ziegler

My memory may be faulty, but I really thought he said "district."
Not that it matters really. Was it recorded?

Probably. If I'm wrong, I'll just have to owe you the beverage of your
choice when I see you next. ;)
[snip other interesting stuff, which reminds me a little of _Wayne's
World_ where Alice Cooper gives the history lesson]

Sorry. I have an interest in linguistics in general (did my final Uni
project on linguistics), history, and am an immigrant to my current
country. It also doesn't hurt that my fianc=E9e is a Francophone (*not*
from Qu=E9bec, but with family origins in Mauritius, lost in the same
treaty terms as Qu=E9bec).

-austin
--=20
Austin Ziegler * (e-mail address removed) * http://www.halostatue.ca/
* (e-mail address removed) * http://www.halostatue.ca/feed/
* (e-mail address removed)
 
R

Rick DeNatale

I wouldn't be surprised if the French sometimes sneered a little at
the French spoken in Quebec, the way (sometimes) Brits make fun of
Americans, or Spanish (or Colombians) make fun of Mexicans.

And, I understand that there are some Qu=E9be=E7ois who maintain that they
speak a purer form of French than the European French do. It's kind
of like the theory that Elizabethan English is still spoken on some of
the islands off the coasts of Virginia and North Carolina.

Actually both French and Canadian French have evolved in different
ways, much as have British and American English.

Some Qu=E9be=E7ois think of themselves as French, hence the "European
French" above. I have a good friend, a native ni=E7oise, who was quite
amused when she was in Canada and some one said to her, "so you're
French, from France!" to which her unspoken reaction was "Where
else?"

--=20
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
 
A

Austin Ziegler

And, I understand that there are some Qu=E9be=E7ois who maintain that the=
y

This spelling is incorrect. It's Qu=E9becois (kay-beh-kwah), not
Qu=E9be=E7ois (kay-beh-swah).
speak a purer form of French than the European French do. It's kind
of like the theory that Elizabethan English is still spoken on some of
the islands off the coasts of Virginia and North Carolina.

"Purer" isn't the right term; "older" is. Said belief is mostly true;
Qu=E9bec was isolated from the linguistic shifts that France experienced
in the late eighteenth and throughout the nineteenth century. And
there probably wouldn't be any Elizabethan English speakers, but some
American English dialects are closer to Georgian (18th century)
English than they are to modern British English; I suspect that
American English dialects in general are closer to 18th century
English than either Canadian or modern British English. I haven't
studied linguistics in a long time, but it is apparently possible to
measure linguistic drift in dialects.
Actually both French and Canadian French have evolved in different
ways, much as have British and American English.
Certainly

Some Qu=E9be=E7ois think of themselves as French, hence the "European
French" above. I have a good friend, a native ni=E7oise, who was quite
amused when she was in Canada and some one said to her, "so you're
French, from France!" to which her unspoken reaction was "Where
else?"

Yes, the French (from France) are famous for being short-sighted that
way, only remembering the rest of La Francophonie when it's
convenient. Even in Europe, France isn't the only source of native
French speakers (Belgium, Switzerland, Luxembourg, and Romania[?!]),
and then you've got a lot of different former French colonies:
Mauritius (officially English, but *everyone* speaks French regardless
of what the Government says), Qu=E9bec, New Brunswick (and in Canada,
the M=E9tis of Manitoba matter, too), Togo, Haiti, Rwanda, and various
other places, too.

-austin
--=20
Austin Ziegler * (e-mail address removed) * http://www.halostatue.ca/
* (e-mail address removed) * http://www.halostatue.ca/feed/
* (e-mail address removed)
 
B

Bira

Yes, the French (from France) are famous for being short-sighted that
way, only remembering the rest of La Francophonie when it's
convenient.

Doesn't 'French' mean "someone who was born in France", rather than
"someone who speaks French" ('francophone') ?
 
A

Austin Ziegler

In France uppercase letters accents are optional, I do not think that the
application of the accents varies by regions. (Dis-le si je dis une gaffe
Franc, je ne suis pas Fran=E7ais)
I do not know about Qu=E9bec.
So Tim is wrong, in a literal sense, sorry, but I guess that the point he
wanted to make is very valid, how would you downcase "TACHE", as "tache" = =3D>
spot or "t=E2che" =3D> task?

Tim is not wrong. Someone's remembering of what Tim said is wrong. In
speaking with him after, it was very clear that he was referring to
larger jurisdictions, such as the differentiation between France and
Canada on uppercase accents.

Again: I don't agree with Tim on some of his positions, but this is
not a place he made a mistake.

-austin
--=20
Austin Ziegler * (e-mail address removed) * http://www.halostatue.ca/
* (e-mail address removed) * http://www.halostatue.ca/feed/
* (e-mail address removed)
 
R

Rick DeNatale

In France uppercase letters accents are optional, I do not think that the
application of the accents varies by regions. (Dis-le si je dis une gaffe
Franc, je ne suis pas Fran=E7ais)

I'm pretty sure that whether or not accented capital letters are
actually accented in French has more to do with typography and
technology than geography or jurisdiction.

I've heard that accents were dropped on capital letters because
accented capitals weren't commonly available on typewriters. I also
understand that it's falling out of common practice, probably due to
the proliferation of digital fonts.

I just checked with the wikipedia and it seems to confirm this FWIW:
http://en.wikipedia.org/wiki/Capitalisation#Accents

--=20
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
 
F

F. Senault

Le 26 octobre 2006 à 02:04, Rick DeNatale a écrit :
I've heard that accents were dropped on capital letters because
accented capitals weren't commonly available on typewriters.

That was my understanding too.

In any case, the Académie française insists that the capital letters
must be accented, if only because some accents can change the meaning of
a word in french.

Fred
 
R

Rick DeNatale

Le 26 octobre 2006 =E0 02:04, Rick DeNatale a =E9crit :


That was my understanding too.

In any case, the Acad=E9mie fran=E7aise insists that the capital letters
must be accented, if only because some accents can change the meaning of
a word in french.

Bien sur. I already communicated this privately to Robert Dober.

En Frinch, the accints ari as moch an aspict uf tha spilleng as which
bisac vowill ur cansonint thiy ure atiched to.


--=20
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
 
J

John W. Kennedy

F. Senault said:
Le 26 octobre 2006 à 02:04, Rick DeNatale a écrit :


That was my understanding too.

No, it goes back at least to the 18th century, to my certain knowledge,
long before typewriters were invented. The typefaces just weren't
designed with the extra room on top, and no one seems to have thought of
(or rejected on aesthetic grounds) shrinking the letters a bit to fit
the accent in.
 
F

F. Senault

Le 27 octobre 2006 à 04:33, John W. Kennedy a écrit :
No, it goes back at least to the 18th century, to my certain knowledge,
long before typewriters were invented. The typefaces just weren't
designed with the extra room on top, and no one seems to have thought of
(or rejected on aesthetic grounds) shrinking the letters a bit to fit
the accent in.

Colour me very surprised. I'd add that I could find more references to
my hypothesis than yours on the web, but not being a specialist, I'll
just stay dubitative.

Now, we're still way off topic for this, so, if you have some pointers
to add or wish to continue the conversation, my email address is valid
(if heavily protected against spam).

Fred
 
J

John W. Kennedy

F. Senault said:
Le 27 octobre 2006 à 04:33, John W. Kennedy a écrit :


Colour me very surprised. I'd add that I could find more references to
my hypothesis than yours on the web, but not being a specialist, I'll
just stay dubitative.

Now, we're still way off topic for this, so, if you have some pointers
to add or wish to continue the conversation, my email address is valid
(if heavily protected against spam).

I've spent a considerable amount of time in the last couple of years
working with the first edition of the 1798 play, "André: a Tragedy in
Five Acts". 'Nuff said.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,216
Messages
2,571,120
Members
47,724
Latest member
Farreach2565

Latest Threads

Top