Explain this line written in JAVA

  • A+
Category:Languages

In HACKERRANK this line of code occurs ery frequently. I think this is to skip whitespaces but what does that "/r/u2028/u2029/u0085" thing mean

 scanner.skip("(/r/n|[/n/r/u2028/u2029/u0085])?"); 

 


Skip /r/n is for Windows.

The rest is standard /r=CR, /n=LF (see /r/n , /r , /n what is the difference between them?)

Then some Unicode special characters:

u2028 = LINE SEPARATOR (https://www.fileformat.info/info/unicode/char/2028/index.htm)

u2029 = PARAGRAPH SEPARATOR (http://www.fileformat.info/info/unicode/char/2029/index.htm)

u0085 = NEXT LINE (https://www.fileformat.info/info/unicode/char/0085/index.htm)

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: