1

I was viewing this answer and I noticed that the delimiter was set to \\A, which is a beep, right? Why is a beep used in the InputStream? I'm still pretty fuzzy on what a beep even is (Isn't is just for a literal beep?), so I am quite confused as to why it's used as the delimiter, here.

Community
  • 1
  • 1
RileyE
  • 10,874
  • 13
  • 63
  • 106

1 Answers1

1

\A is the beginning of the string. It differs from ^ in that most regex implementations ^ matches after line breaks as well, while \A does not.

\a is the bell character.

femtoRgon
  • 32,893
  • 7
  • 60
  • 87
  • Okay. Why would that be the delimiter, though? Shouldn't it start at the `\A` anyways? – RileyE Apr 16 '13 at 18:09
  • The answer you refer to uses it as a delimiter. This allows the entire contents of the stream to be returned in a single String token, from `Scanner.next()`. – femtoRgon Apr 16 '13 at 18:15
  • What is the default value, then? I would have figured that if a dilimiter wasn't set, that it would return the whole string anyways. – RileyE Apr 16 '13 at 18:17
  • 1
    Scanner delimits on whitespace, by default, as defined by [`Character.isWhitespace`](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Character.html#isWhitespace(char)) – femtoRgon Apr 16 '13 at 18:20