• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT] java question string parsing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] java question string parsing


  • Subject: Re: [OT] java question string parsing
  • From: "Daniele Corti" <email@hidden>
  • Date: Tue, 12 Jun 2007 11:07:57 +0200



2007/6/12, Ute Hoffmann <email@hidden>:
hallo,
is there someone around who can give me a hint how I could parse a
String like "VollstaendigReonviert" into "Vollstaendig Reonviert"? Of
course I do not know what is in the string beforehand, thus I need a
means to check whether there are capital letters inside of the string
and where. The remaining part is easy.

Any ideas?

that's easy:
     String str = "VollstaendigReonviert";
     for(int i = 0; i < str.lenght; i++)
     {
        char c = str.chatAt(i); // then char
        if(Character.isUpperCase(c)) //is uppercase
        {
           String sub1, sub2;
           sub1 = str.substring(0,i); // e.g. Vollstaending
           sub2 = srt.substring(i);// e.g. Reonviert
           str = sub1+" "+sub2;
           i++; //to avoid it parse the save letter twice
        }
     }
     if(str.charAt(0).equals(' '))
         str = str.substring(0); //This because the method adds a space in index=0 if the first letter is Upper

Thanks,
Ute

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (

This email sent to email@hidden



--
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden

--
Computers are like air conditioners -- they stop working properly if you open
WINDOWS
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[OT] java question string parsing (From: Ute Hoffmann <email@hidden>)

  • Prev by Date: Re: News from Webobjecs sessions
  • Next by Date: Re: [OT] java question string parsing
  • Previous by thread: Re: [OT] java question string parsing
  • Next by thread: Re: [OT] java question string parsing
  • Index(es):
    • Date
    • Thread