You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by Tony Thompson <To...@stone-ware.com> on 2001/02/15 22:42:15 UTC

Titlecase

I am attempting to titlecase a match on the word "the" and it doesn't seem
to be working.  Here is my code:

    Perl5Util perl = new Perl5Util();
    System.out.println( perl.substitute("s/the/\\u$&/g", input ) );

It simply replaces any occurrence of "the" with "\u$&".  Can anyone provide
any information?


Re: Titlecase

Posted by Nick Bauman <ni...@webhelp.com>.
If you want to do substitutions with interpolations, you should use the
POSIX-style substitutions that ORO supports.

...
if (matcher.contains(text, pattern)) {
      result = matcher.getMatch();
      temp = result.toString();
      question = temp.substring(result.begin(1), result.end(1));
}
...

That will get you the matched string. When you use perenthesis in your
regex, you will have a list of matches for each call. It's all in the doc.
The Perl 5 idioms are inherently not very portable so you shouldn't rely on
them.

----- Original Message -----
From: "Tony Thompson" <To...@stone-ware.com>
To: <or...@jakarta.apache.org>
Sent: Thursday, February 15, 2001 1:42 PM
Subject: Titlecase


> I am attempting to titlecase a match on the word "the" and it doesn't seem
> to be working.  Here is my code:
>
>     Perl5Util perl = new Perl5Util();
>     System.out.println( perl.substitute("s/the/\\u$&/g", input ) );
>
> It simply replaces any occurrence of "the" with "\u$&".  Can anyone
provide
> any information?
>


Re: Titlecase

Posted by Michael McCallum <mi...@spinsoftware.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 15 Feb 2001, at 16:42, Tony Thompson wrote:

> I am attempting to titlecase a match on the word "the" and it doesn't seem
> to be working.  Here is my code:
> 
>     Perl5Util perl = new Perl5Util();
>     System.out.println( perl.substitute("s/the/\\u$&/g", input ) );
> 
> It simply replaces any occurrence of "the" with "\u$&".  Can anyone provide
> any information?
> 
I dont believe that is supported.



-----BEGIN PGP SIGNATURE-----
Version: N/A

iQA/AwUBOovBdrPjWznw9K1HEQL4KgCgypzVgNZjpCUZ6FE3mMnUPouHXwAAoMRo
NJBmzscsP4yOfvwXiTy5YExu
=jxqo
-----END PGP SIGNATURE-----
--- BEGIN GEEK CODE BLOCK ---
Version 3.12
GCS d+(-) s:- a-- C++(+++)$ UL++++(H)(S)$ P+++$ L+++$>++++
E--- W++ N++ o++ K? !w() O? !M V? PS+ PE+++ Y+ t+ 5++ X++ 
R(+) !tv b++(++++) D++ G>++ e++> h--()(*) r+ y+()
--- END GEEK CODE BLOCK ---