se.vandmo.textchecker.maven.fixers.MakeLineSeparatorsConsistent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of text-checker-maven-plugin Show documentation
Show all versions of text-checker-maven-plugin Show documentation
Maven plugin that checks that text files adheres to certain rules.
package se.vandmo.textchecker.maven.fixers;
import static java.lang.System.lineSeparator;
import static org.apache.commons.lang3.StringUtils.remove;
import static org.apache.commons.lang3.StringUtils.replace;
import se.vandmo.textchecker.maven.Content;
import se.vandmo.textchecker.maven.Fixer;
public final class MakeLineSeparatorsConsistent implements Fixer {
@Override
public void fix(Content content) {
content.data(fixLineSeparators(content.data()));
}
private String fixLineSeparators(String data) {
data = remove(data, "\r");
data = replace(data, "\n", lineSeparator());
return data;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy