blob: 036a5600a76f69204f05cec8edf83291121edde4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
package com.keuin.psmb4j.util;
import java.nio.charset.StandardCharsets;
public class StringUtils {
/**
* If the string can be encoded into binary using ASCII.
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean isPureAscii(String v) {
return StandardCharsets.US_ASCII.newEncoder().canEncode(v);
// or "ISO-8859-1" for ISO Latin 1
}
}
|