Trim newlines at start/end of lyrics

Collapse more than one empty lines into one
This commit is contained in:
tkashkin 2017-07-14 14:05:21 +03:00
commit aabd0367b9
2 changed files with 3 additions and 3 deletions

View file

@ -44,10 +44,10 @@ public abstract class AbsSynchronizedLyrics extends Lyrics {
for (int i = 0; i < lines.size(); i++) {
String line = lines.valueAt(i);
sb.append(line).append('\n');
sb.append(line).append("\r\n");
}
return sb.toString();
return sb.toString().trim().replaceAll("(\r?\n){3,}", "\r\n\r\n");
}
return super.getText();

View file

@ -59,7 +59,7 @@ public class Lyrics {
}
public String getText() {
return this.data;
return this.data.trim().replaceAll("(\r?\n){3,}", "\r\n\r\n");
}
static {