Java Utililty Methods String Cut

List of utility methods to do String Cut

  1. HOME
  2. Java
  3. S
  4. String Cut

Description

The list of methods to do String Cut are organized into topic(s).

Method

String cutString(String str, int length, String charsetName)
cut String
int len = str.getBytes(charsetName).length;
if (len > length) {
 char[] chars = str.toCharArray();
 int i = 0;
 for (; i < chars.length; i++) {
 String tstr = new String(chars, 0, i + 1);
 if (tstr.getBytes(charsetName).length > length) {
 i--;
...

AltStyle によって変換されたページ (->オリジナル) /