-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
  • 274,122
  • 60
  • 696
  • 724
Hiren
  • 242
  • 1
  • 9

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,625
  • 7
  • 34
  • 65
  • 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