// 指定バイト数まで文字列切り詰め
private static String truncateToByteLength(String s, Integer byteLength) {
if (s == null) {
return null;
}
while (Blob.valueOf(s).size() > byteLength) {
s = s.substring(0, s.length() - 1);
}
return s;
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme