Skip to content

Instantly share code, notes, and snippets.

@zhaohangbo
Created September 24, 2016 05:37
Show Gist options
  • Save zhaohangbo/027244d01d82447e10116ecdf8fb3d28 to your computer and use it in GitHub Desktop.
Save zhaohangbo/027244d01d82447e10116ecdf8fb3d28 to your computer and use it in GitHub Desktop.
换行符 \r, \n, \r\n
\r = CR (Carriage Return) // Used as a new line character in Mac OS before X
\n = LF (Line Feed) // Used as a new line character in Unix/Mac OS X
\r\n = CR + LF // Used as a new line character in Windows
So,
String lines[] = String.split("\\r?\\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment