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