split string \r\n java into list code example Example: split by new line java String lines[] = string.split("\\r?\\n");