Java String Length Get lengthByteInPrepared(String s)

Here you can find the source of lengthByteInPrepared(String s)

Description

length Byte In Prepared

License

Apache License

Declaration

public static int lengthByteInPrepared(String s) 

Method Source Code

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

public class Main {

    public static int lengthByteInPrepared(String s) {
        int length = 0;

        if (s == null) {
            return length;
        }//from  ww  w.  j a  v  a 2 s  .  c  o  m

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) <= 127) {
                length++;
            } else {
                length = length + 3;
            }
        }
        return length;
    }
}

Related

  1. length(String str)
  2. length(String string)
  3. length(String string)
  4. length(String... args)
  5. lengthBetween(String param, int minLength, int maxLength)
  6. lengthCheck(final String str, final int minLength, final int maxLength)
  7. lengthConstToString(int val, int len)
  8. LengthConversionFactor(String OldUnits)
  9. lengthExpandedTabs(String string, int toIdx, int tabWidth)