aspose file tools*
The moose likes Beginning Java and the fly likes Strings Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Strings Problem" Watch "Strings Problem" New topic
Author

Strings Problem

siddu banjapally
Greenhorn

Joined: Aug 16, 2011
Posts: 13

Hi friends..
I have one doubt that is, I have one string as following

String s="a1b2c3 dd4f5g10h11z";

then how can I print only alphabets or numbers only??
Vijay Tidake
Ranch Hand

Joined: Nov 04, 2008
Posts: 146

Hi,

Try this.

Edit: removed complete solution.

Thanks


The important thing is not to stop questioning.Curiosity has its own reason for existing.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

@Vijay: I've removed your complete solution. See the forum description:
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.


@siddu
Hi and welcome to the JavaRanch!

Try to iterate through the string and check if each character is a number/somethingElse.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Vijay Tidake
Ranch Hand

Joined: Nov 04, 2008
Posts: 146

Hi Wouter Oet,

Thanks for reminding me the rule. Onward I will follow it.

Thanks
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
@siddu
Welcome to javaranch
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11476
    
  16

if you didn't have a computer, how would you do it with pencil and paper? explain step by step what you would do.

Once you have that (and I literally mean for you to write it down), it's easy to code.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
siddu banjapally
Greenhorn

Joined: Aug 16, 2011
Posts: 13

THANKS to all
Siddu
suryakanta sahoo
Greenhorn

Joined: Aug 20, 2011
Posts: 5
 
jQuery in Action, 2nd edition
 
subject: Strings Problem