• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Disecting a String

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm working on the cattle drive on Assignment OOP - 2. My question is how do I take the following example:
String number = "thirty-two";
and covert that string into two:
String first = "thirty";
String two = "two";
I've looked at stringbuffer, string, and character classes but have yet to figure this out. Any hints would be appreciated.
Thanks,
Jeremy
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how much we are supposed to help but the class you need to look at is StringTokenizer.
 
Jeremy Donaldson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Great thanks.
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the methods of the String class. You might find something there that you like.
Matthew Phillips
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!