Example usage for java.lang StringBuffer equals

List of usage examples for java.lang StringBuffer equals

Introduction

In this page you can find the example usage for java.lang StringBuffer equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:usbong.android.utils.UsbongUtils.java

public static ArrayList<String> extractKanjiPhrasesFromString(String s) {
    ArrayList<String> output = new ArrayList<String>();
    StringBuffer kanjiPhrase = new StringBuffer();

    //go through character by character
    for (int i = 0; i < s.length(); i++) {
        //Reference: http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml;
        //last accessed: 4 Oct. 2014
        //Reference: http://stackoverflow.com/questions/3826918/how-to-classify-japanese-characters-as-either-kanji-or-kana;
        //last accessed: 4 Oct. 2014;
        //answer by Jack, Sept. 30, 2010
        //while Kanji Char
        for (int value = (int) s.charAt(i); value >= 0x4e00 && value <= 0x9faf;) {
            kanjiPhrase.append(s.charAt(i));
            i++;/*w w  w  .  j  av a  2s .c  om*/
            value = (int) s.charAt(i);
        }

        if (!kanjiPhrase.equals("")) {
            output.add(kanjiPhrase.toString());
            kanjiPhrase.replace(0, kanjiPhrase.length(), "");
        }
    }

    return output;
}