Java

posted by .

Is there a method in Java in which to see if an integer value contains characters?

  • Java -

    By definition, an integer value does not contain characters (apart from the minus sign), otherwise the value is invalid.

    If you have a String and would like to check for foreign characters, you can try:
    the matches() method using a regular expression.
    For example, if you suspect alphabetic characters, you can check using:
    if(someString.matches("[a-zA-Z]")
    {
    // do something
    }

    If you want to scan for all non-numeric characters, you can replace with
    ...matches("[^0-9]")...

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Java

    What kind of Math do I need to be proficient in in order to be prepared for a college course in java?
  2. java

    Write the following methods and test them.this need to be execute it in Eclipse IDE for Java Developers 1. printVowels - this method should take a String as a parameter and print all the vowels contained in that String one character …
  3. please help java

    please help me with that as soon as any bady can processExpression - this method should take a String in the format: "integer [[+-*/] integer]*]" Your method should then process this expression and return the result as an integer. …
  4. Java

    Can someone please help me out!!!I included what I have so far. *Purpose Implement a Java-method with three local int variables a, b, c, d and e that sorts these three values in ascending order by comparing and exchanging their values. …
  5. programming

    write a java application to calculate the exponent value of a number using the following specification <Prompt the user to enter an integer value <Pass the integer value to the method squares the number and to a method cubes …
  6. java

    Write a java application that finds the smallest of several integers. Prompt the user for the number of integers that will be input, then prompt the user for that number of integers. Evaluate the integers to determine the smallest …
  7. java programming

    Create a java program that will calculate the current grade in a classroom. The program should ask for 5 grades as well as total point value per grade available.
  8. pseudo code algorithm

    Convert your algorithm from Question One into a complete Java application. Marks will be allocated based upon: ● Your Java code matching your pseudo code algorithm from Question One. ● Your Java code being syntactically …
  9. Java code

    Write the Java code of the method Mirror that takes one 2-dimentional array (squared matrix) A1, and returns 2D array A2 which is the mirror image of A1.
  10. java

    Write the Java code of the method Mirror that takes one 2-dimentional array (squared matrix) A1, and returns 2D array A2 which is the mirror image of A1.

More Similar Questions