bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/Java/Java Reference
Java•Java Reference

Java Scanner delimiter() Method

❮ Scanner Methods

Example

Show the delimiter that is currently being used by the scanner:

// Create a scanner object Scanner myObj = new Scanner("A string to scan");
// Find the delimiter System.out.println(myObj.delimiter());
// Close the scanner myObj.close();

Definition and Usage

The delimiter() method returns a Pattern object describing the sequence of characters which separates tokens in the data being scanned. The default delimiter is a sequence of whitespace characters, but it can be changed with the useDelimiter() method.

Learn more about the Pattern object in our Java RegEx tutorial .

What is a token?

A token is a sequence of characters separated from other tokens by delimiters.

Syntax

public Pattern delimiter()

Technical Details

Returns:A Pattern object describing the sequence of characters that the scanner uses as a delimiter.

❮ Scanner Methods

Previous

Java Scanner close() Method

Next

Java Scanner findInLine() Method

This chapter

Overview
264

Lessons

546m

Read time

1. Java Keywords2. Java assert Keyword3. Java abstract Keyword4. Java boolean Keyword5. Java break Keyword6. Java byte Keyword7. Java case Keyword8. Java catch Keyword9. Java char Keyword10. Java class Keyword11. Java continue Keyword12. Java default Keyword13. Java do Keyword14. Java double Keyword15. Java else Keyword16. Java enum Keyword17. Java exports Keyword18. Java extends Keyword19. Java final Keyword20. Java finally Keyword21. Java float Keyword22. Java for Keyword23. Java if Keyword24. Java implements Keyword25. Java import Keyword26. Java instanceof Keyword27. Java int Keyword28. Java interface Keyword29. Java long Keyword30. Java module Keyword31. Java native Keyword32. Java new Keyword33. Java package Keyword34. Java private Keyword35. Java protected Keyword36. Java public Keyword37. Java return Keyword38. Java requires Keyword39. Java short Keyword40. Java static Keyword41. Java super Keyword42. Java switch Keyword43. Java synchronized Keyword44. Java this Keyword45. Java throw Keyword46. Java throws Keyword47. Java transient Keyword48. Java try Keyword49. Java var Keyword50. Java void Keyword51. Java volatile Keyword52. Java while Keyword53. Java String Methods54. Java String charAt() Method55. Java String codePointAt() Method56. Java String codePointBefore() Method57. Java String codePointCount() Method58. Java String compareTo() Method59. Java String compareToIgnoreCase() Method60. Java String concat() Method61. Java String contains() Method62. Java String contentEquals() Method63. Java String copyValueOf() Method64. Java String endsWith() Method65. Java String equals() Method66. Java String equalsIgnoreCase() Method67. Java String format() Method68. Java String getBytes() Method69. Java String getChars() Method70. Java String hashCode() Method71. Java String indexOf() Method72. Java String isEmpty() Method73. Java String join() Method74. Java String lastIndexOf() Method75. Java String length() Method76. Java String matches() Method77. Java String offsetByCodePoints() Method78. Java String regionMatches() Method79. Java String replace() Method80. Java String replaceAll() Method81. Java String replaceFirst() Method82. Java String split() Method83. Java String startsWith() Method84. Java String subSequence() Method85. Java String substring() Method86. Java String toCharArray() Method87. Java String toLowerCase() Method88. Java String toString() Method89. Java String toUpperCase() Method90. Java String trim() Method91. Java String valueOf() Method92. Java Math Methods93. Java Math abs() Method94. Java Math acos() Method95. Java Math addExact() Method96. Java Math asin() Method97. Java Math atan() Method98. Java Math atan2() Method99. Java Math cbrt() Method100. Java Math ceil() Method101. Java Math copySign() Method102. Java Math cos() Method103. Java Math cosh() Method104. Java Math decrementExact() Method105. Java Math exp() Method106. Java Math expm1() Method107. Java Math floor() Method108. Java Math floorDiv() Method109. Java Math floorMod() Method110. Java Math getExponent() Method111. Java Math hypot() Method112. Java Math IEEEremainder() Method113. Java Math incrementExact() Method114. Java Math log() Method115. Java Math log10() Method116. Java Math log1p() Method117. Java Math max() Method118. Java Math min() Method119. Java Math multiplyExact() Method120. Java Math negateExact() Method121. Java Math nextAfter() Method122. Java Math nextDown() Method123. Java Math nextUp() Method124. Java Math pow() Method125. Java Math random() Method126. Java Math rint() Method127. Java Math round() Method128. Java Math scalb() Method129. Java Math signum() Method130. Java Math sin() Method131. Java Math sinh() Method132. Java Math sqrt() Method133. Java Math subtractExact() Method134. Java Math tan() Method135. Java Math tanh() Method136. Java Math toDegrees() Method137. Java Math toIntExact() Method138. Java Math toRadians() Method139. Java Math ulp() Method140. Java Output Methods141. Java Output print() Method142. Java Output printf() Method143. Java Output println() Method144. Java Arrays Class145. Java Arrays. compare() Method146. Java Arrays. equals() Method147. Java Arrays. sort() Method148. Java Arrays. fill() Method149. Java Array length Property150. Java ArrayList Methods151. Java ArrayList add() Method152. Java ArrayList add() Method153. Java ArrayList clear() Method154. Java ArrayList clone() Method155. Java ArrayList contains() Method156. Java ArrayList ensureCapacity() Method157. Java ArrayList forEach() Method158. Java ArrayList get() Method159. Java ArrayList indexOf() Method160. Java ArrayList isEmpty() Method161. Java ArrayList iterator() Method162. Java ArrayList lastIndexOf() Method163. Java ArrayList listIterator() Method164. Java ArrayList remove() Method165. Java ArrayList removeAll() Method166. Java ArrayList removeIf() Method167. Java ArrayList replaceAll() Method168. Java ArrayList retainAll() Method169. Java ArrayList set() Method170. Java ArrayList size() Method171. Java ArrayList sort() Method172. Java ArrayList spliterator() Method173. Java ArrayList subList() Method174. Java ArrayList toArray() Method175. Java ArrayList trimToSize() Method176. Java LinkedList Methods177. Java LinkedList add() Method178. Java LinkedList add() Method179. Java LinkedList clear() Method180. Java LinkedList clone() Method181. Java LinkedList contains() Method182. Java LinkedList forEach() Method183. Java LinkedList get() Method184. Java LinkedList getFirst() Method185. Java LinkedList getLast() Method186. Java LinkedList indexOf() Method187. Java LinkedList isEmpty() Method188. Java LinkedList iterator() Method189. Java LinkedList lastIndexOf() Method190. Java LinkedList listIterator() Method191. Java LinkedList remove() Method192. Java LinkedList removeAll() Method193. Java LinkedList removeFirst() Method194. Java LinkedList removeIf() Method195. Java LinkedList removeLast() Method196. Java LinkedList replaceAll() Method197. Java LinkedList retainAll() Method198. Java LinkedList set() Method199. Java LinkedList size() Method200. Java LinkedList sort() Method201. Java LinkedList spliterator() Method202. Java LinkedList subList() Method203. Java LinkedList toArray() Method204. Java HashMap Methods205. Java HashMap clear() Method206. Java HashMap clone() Method207. Java HashMap compute() Method208. Java HashMap computeIfAbsent() Method209. Java HashMap computeIfPresent() Method210. Java HashMap containsKey() Method211. Java HashMap containsValue() Method212. Java HashMap entrySet() Method213. Java HashMap forEach() Method214. Java HashMap get() Method215. Java HashMap getOrDefault() Method216. Java HashMap isEmpty() Method217. Java HashMap keySet() Method218. Java HashMap merge() Method219. Java HashMap put() Method220. Java HashMap putAll() Method221. Java HashMap putIfAbsent() Method222. Java HashMap remove() Method223. Java HashMap replace() Method224. Java HashMap replaceAll() Method225. Java HashMap size() Method226. Java HashMap values() Method227. Java Scanner Methods228. Java Scanner close() Method229. Java Scanner delimiter() Method230. Java Scanner findInLine() Method231. Java Scanner findWithinHorizon() Method232. Java Scanner hasNext() Method233. Java Scanner hasNextBoolean() Method234. Java Scanner hasNextByte() Method235. Java Scanner hasNextDouble() Method236. Java Scanner hasNextFloat() Method237. Java Scanner hasNextInt() Method238. Java Scanner hasNextLine() Method239. Java Scanner hasNextLong() Method240. Java Scanner hasNextShort() Method241. Java Scanner locale() Method242. Java Scanner next() Method243. Java Scanner nextBoolean() Method244. Java Scanner nextByte() Method245. Java Scanner nextDouble() Method246. Java Scanner nextFloat() Method247. Java Scanner nextInt() Method248. Java Scanner nextLine() Method249. Java Scanner nextLong() Method250. Java Scanner nextShort() Method251. Java Scanner radix() Method252. Java Scanner reset() Method253. Java Scanner useDelimiter() Method254. Java Scanner useLocale() Method255. Java Scanner useRadix() Method256. Java File Class Methods257. Java FileInputStream Methods258. Java FileOutputStream Methods259. Java BufferedReader Methods260. Java BufferedWriter Methods261. Java Iterator Interface262. Java Collections Class Methods263. Java System Methods264. Java Errors and Exception Types

On this page

Definition and UsageTechnical Details