Java Scanner Usage getFirstInt(String s)

Here you can find the source of getFirstInt(String s)

Description

get First Int

License

Open Source License

Declaration

public static Integer getFirstInt(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    public static Integer getFirstInt(String s) {
        Scanner in = new Scanner(s).useDelimiter("[^0-9]+".intern());
        if (in.hasNext()) {
            return in.nextInt();
        } else {//from w  w  w .  jav  a 2 s  . co m
            return null;
        }
    }
}

Related

  1. getChar()
  2. getConstantPoolsFromText(String text)
  3. getDirectoryString()
  4. getEndLine(String cqlString)
  5. getExtensions(Scanner scanner)
  6. getInput(Scanner in, String message, boolean allowNull)
  7. getInt()
  8. getInt(Scanner sc)
  9. getInteger(String parameter)