summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/psmb4j/util/StringUtils.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-02-04 22:54:22 +0800
committerKeuin <[email protected]>2022-02-04 22:54:22 +0800
commitdfa163e5a3cffa46f0241210f2c8be1f8e298d7a (patch)
tree72db589d79bcc3bbca45c3a34a6dac71b2f55526 /src/main/java/com/keuin/psmb4j/util/StringUtils.java
parent12ddbba66e6f2585e59d05d1782c0e8ce9fe6146 (diff)
Add psmb support.
Diffstat (limited to 'src/main/java/com/keuin/psmb4j/util/StringUtils.java')
-rw-r--r--src/main/java/com/keuin/psmb4j/util/StringUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/psmb4j/util/StringUtils.java b/src/main/java/com/keuin/psmb4j/util/StringUtils.java
new file mode 100644
index 0000000..036a560
--- /dev/null
+++ b/src/main/java/com/keuin/psmb4j/util/StringUtils.java
@@ -0,0 +1,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
+ }
+}