Java ASCII asciiLength(String str)

Here you can find the source of asciiLength(String str)

Description

ascii Length

License

Apache License

Declaration

public static int asciiLength(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static int asciiLength(String str) {
        int length = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            length += c > 127 ? 2 : 1;
        }//from  w ww .  j  av  a 2s. co  m

        return length;
    }
}

Related

  1. asciiEqualsIgnoreCase(byte[] a, byte[] b)
  2. asciiEqualsIgnoreCase(byte[] buf1, byte[] buf2)
  3. asciiFill2(String str, int startIdx, String fillStr)
  4. asciify(String s)
  5. asciiIdx2StrIdx(String str, int asciiIdx)
  6. asciiPaddingR(String str, int length, String padding)
  7. asciiQuads(String word)
  8. asciiString(byte[] bytes, int from, int count)
  9. asciiString(String fourcc)