java語言中Scanner的使用


 

void

close() 
          關閉此掃描器。

 Pattern

delimiter() 
          返回此 Scanner 當前正在用於匹配分隔符的 Pattern。

 String

findInLine(Pattern pattern) 
          試圖在忽略分隔符的情況下查找下一個指定模式。

 String

findInLine(String pattern) 
          試圖在忽略分隔符的情況下查找下一個從指定字符串構造的模式。

 String

findWithinHorizon(Pattern pattern, int horizon) 
          試圖查找下一個指定模式。

 String

findWithinHorizon(String pattern, int horizon) 
          試圖在忽略分隔符的情況下查找下一個從指定字符串構造的模式。

 boolean

hasNext() 
          如果此掃描器的輸入中有另一個標記,則返回 true。

 boolean

hasNext(Pattern pattern) 
          如果下一個完整標記與指定模式匹配,則返回 true。

 boolean

hasNext(String pattern) 
          如果下一個標記與從指定字符串構造的模式匹配,則返回 true。

 boolean

hasNextBigDecimal() 
          如果通過使用 nextBigDecimal() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 BigDecimal,則返回 true。

 boolean

hasNextBigInteger() 
          如果通過使用 nextBigInteger() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 BigInteger 值,則返回 true。

 boolean

hasNextBigInteger(int radix) 
          如果通過使用 nextBigInteger() 方法,此掃描器輸入信息中的下一個標記可以解釋為指定基數中的一個 BigInteger 值,則返回 true。

 boolean

hasNextBoolean() 
          如果通過使用一個從字符串 "true|false" 創建的大小寫敏感的模式,此掃描器輸入信息中的下一個標記可以解釋為一個布爾值,則返回 true。

 boolean

hasNextByte() 
          如果通過使用 nextByte() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個字節值,則返回 true。

 boolean

hasNextByte(int radix) 
          如果通過使用 nextByte() 方法,此掃描器輸入信息中的下一個標記可以解釋為指定基數中的一個字節值,則返回 true。

 boolean

hasNextDouble() 
          如果通過使用 nextDouble() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 double 值,則返回 true。

 boolean

hasNextFloat() 
          如果通過使用 nextFloat() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 float 值,則返回 true。

 boolean

hasNextInt() 
          如果通過使用 nextInt() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 int 值,則返回 true。

 boolean

hasNextInt(int radix) 
          如果通過使用 nextInt() 方法,此掃描器輸入信息中的下一個標記可以解釋為指定基數中的一個 int 值,則返回 true。

 boolean

hasNextLine() 
          如果在此掃描器的輸入中存在另一行,則返回 true。

 boolean

hasNextLong() 
          如果通過使用 nextLong() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 long 值,則返回 true。

 boolean

hasNextLong(int radix) 
          如果通過使用 nextLong() 方法,此掃描器輸入信息中的下一個標記可以解釋為指定基數中的一個 long 值,則返回 true。

 boolean

hasNextShort() 
          如果通過使用 nextShort() 方法,此掃描器輸入信息中的下一個標記可以解釋為默認基數中的一個 short 值,則返回 true。

 boolean

hasNextShort(int radix) 
          如果通過使用 nextShort() 方法,此掃描器輸入信息中的下一個標記可以解釋為指定基數中的一個 short 值,則返回 true。

 IOException

ioException() 
          返回此 Scanner 的底層 Readable 最后拋出的 IOException。

 Locale

locale() 
          返回此掃描器的語言環境。

 MatchResult

match() 
          返回此掃描器所執行的最后掃描操作的匹配結果。

 String

next() 
          查找並返回來自此掃描器的下一個完整標記。

 String

next(Pattern pattern) 
          如果下一個標記與指定模式匹配,則返回下一個標記。

 String

next(String pattern) 
          如果下一個標記與從指定字符串構造的模式匹配,則返回下一個標記。

 BigDecimal

nextBigDecimal() 
          將輸入信息的下一個標記掃描為一個 BigDecimal。

 BigInteger

nextBigInteger() 
          將輸入信息的下一個標記掃描為一個 BigInteger。

 BigInteger

nextBigInteger(int radix) 
          將輸入信息的下一個標記掃描為一個 BigInteger。

 boolean

nextBoolean() 
          掃描解釋為一個布爾值的輸入標記並返回該值。

 byte

nextByte() 
          將輸入信息的下一個標記掃描為一個 byte。

 byte

nextByte(int radix) 
          將輸入信息的下一個標記掃描為一個 byte。

 double

nextDouble() 
          將輸入信息的下一個標記掃描為一個 double。

 float

nextFloat() 
          將輸入信息的下一個標記掃描為一個 float。

 int

nextInt() 
          將輸入信息的下一個標記掃描為一個 int。

 int

nextInt(int radix) 
          將輸入信息的下一個標記掃描為一個 int。

 String

nextLine() 
          此掃描器執行當前行,並返回跳過的輸入信息。

 long

nextLong() 
          將輸入信息的下一個標記掃描為一個 long。

 long

nextLong(int radix) 
          將輸入信息的下一個標記掃描為一個 long。

 short

nextShort() 
          將輸入信息的下一個標記掃描為一個 short。

 short

nextShort(int radix) 
          將輸入信息的下一個標記掃描為一個 short。

 int

radix() 
          返回此掃描器的默認基數。

 void

remove() 
          Iterator 的這種實現不支持移除操作。

 Scanner

reset() 
          重置此掃描器。

 Scanner

skip(Pattern pattern) 
          在忽略分隔符的情況下跳過與指定模式匹配的輸入信息。

 Scanner

skip(String pattern) 
          跳過與從指定字符串構造的模式匹配的輸入信息。

 String

toString() 
          返回此 Scanner 的字符串表示形式。

 Scanner

useDelimiter(Pattern pattern) 
          將此掃描器的分隔模式設置為指定模式。

 Scanner

useDelimiter(String pattern) 
          將此掃描器的分隔模式設置為從指定 String 構造的模式。

 Scanner

useLocale(Locale locale) 
          將此掃描器的語言環境設置為指定的語言環境。

 Scanner

useRadix(int radix) 
          將此掃描器的默認基數設置為指定基數。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM