Added String.isLatin()

@see https://www.filebot.net/forums/viewtopic.php?f=5&t=2&p=28963#p28963
This commit is contained in:
Reinhard Pointner 2017-06-21 09:18:04 +08:00
parent a53d719e07
commit 395ec3a4b8
1 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.Normalizer;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
@ -396,6 +397,10 @@ public class ExpressionFormatMethods {
return Normalization.normalizeQuotationMarks(self);
}
public static boolean isLatin(String self) {
return Normalizer.normalize(self, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}", "").matches("^\\p{InBasicLatin}+$");
}
/**
* Replace multiple replacement pairs
*