Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static int lastIndexOfChinese(String text) {
        char[] charArray = text.toCharArray();
        int index = -1;
        for (int i = 0; i < charArray.length; i++) {
            String tempC = Character.toString(charArray[i]);
            if (tempC.matches("[\u4E00-\u9FA5]+")) {
                index = i;
            }
        }
        return index;
    }
}