Kana Tools for Java

What Is This Library?

Light-weight utilities that make your life easier when dealing with Japanese text.
Quickly process text containing kana characters with just a few lines of code.

Get Latest Stable Release GitHub Repository Download JAR

Converting Kana

Import:
import com.mariten.kanatools.KanaConverter;
Code:
String input_str = "テスティング 1−2−3";

// Set the desired conversion flags
int conv_op_flags = 0;
conv_op_flags |= KanaConverter.OP_HAN_KATA_TO_ZEN_KATA;
conv_op_flags |= KanaConverter.OP_ZEN_ASCII_TO_HAN_ASCII;

// Convert the string
String output_str = KanaConverter.convertKana(input_str, conv_op_flags);

// Compare result
System.out.println("Before:  " + input_str);
System.out.println("After:   " + output_str);
Output:
Before:  テスティング 1−2−3
After:   テスティング 1-2-3
KanaConverter
Easy back-and-forth conversion of kana, hankaku, zenkaku, and other characters used in Japanese text