Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    static int i = 1;

    public static int getStringAllLength(String str) {
        int len = 0;
        for (int i = 0; i < str.length(); i++) {
            if (isChineseChars(str.charAt(i))) {
                len += 2;
            } else {
                len++;
            }
        }
        return len;
    }

    public static boolean isChineseChars(int num) {
        return (num >= 11904 && num <= 65519);
    }
}