-1
scanner.useDelimiter("\\A").hasNext() ? scanner.next() : "";

What is the significance of "\\A" here? As far as I know this will match literally \A

Also I have seen people using "\\Z" at the same place.

Sotirios Delimanolis
  • 263,859
  • 56
  • 671
  • 702
Hiren
  • 212
  • 1
  • 8

1 Answers1

1

In regex

  • \A indicates start of String
  • \z indicates end of String

For more details, refer below the link.

https://www.rexegg.com/regex-quickstart.html

Sambit
  • 7,063
  • 5
  • 29
  • 58
  • Any comment on code part ? What I am understanding is that using useDelimiter("\\A") we are dividing the string and finding its actual content using .hasNext() – Hiren May 19 '19 at 16:59