• Post Reply Bookmark Topic Watch Topic
  • New Topic

String prog  RSS feed

 
Kartik rocky
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me in a program i.e
if i enter a string 123 then the output should be displayed as the entered string is Numeric.
and if i enter the string 123abc the output should be displayed as entered string is Alphanumeric.

please help me out regarding this i am a beginner so its little confusing !!
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

java.util.Scanner lets you do both getting the input from users and checking if it's a number.
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use regex to find out.

Here is my example.
http://www.coderanch.com/t/561513/java/java/new-matchres

Replace

with
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!