Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mayhoo.kanji
Class JapaneseString  view JapaneseString download JapaneseString.java

java.lang.Object
  extended bycom.mayhoo.kanji.JapaneseString

public class JapaneseString
extends java.lang.Object

JapaneseString contains static functions to do various tests on Strings to determine if it consists one of the various types of characters used in the japanese writing system. There are also a functions to translate between Katakana, Hiragana, and Romaji.

Version:
$Id: JapaneseString.java,v 1.2 2002/04/20 18:10:24 djmay Exp $

Field Summary
protected static java.lang.String[] romaji
          The array used to map hirgana to romaji.
private static java.lang.String VERSION
          Version information
protected static java.lang.String[] voicedRomaji
          The array used to map hirgana to romaji.
 
Constructor Summary
JapaneseString()
           
 
Method Summary
static boolean isFullwidthKatakana(java.lang.String str)
          Determines if this character is a Full width Katakana.
static boolean isHalfwidthKatakana(java.lang.String str)
          Determines if this character is a Half width Katakana.
static boolean isHiragana(java.lang.String str)
          Determines if this character is one of the Japanese Hiragana.
static boolean isKana(java.lang.String str)
          Determines if this character is a Japanese Kana.
static boolean isKanji(java.lang.String str)
          Determines if this character is a Kanji character.
static boolean isKatakana(java.lang.String str)
          Determines if this character is one of the Japanese Katakana.
static boolean isRomaji(java.lang.String str)
          Determines if this character could be used as part of a romaji character.
private static java.lang.String lookupRomaji(char c)
          Access the array to return the correct romaji string.
static java.lang.String toHiragana(java.lang.String str)
          Translates this character into the equivalent Hiragana character.
static java.lang.String toKatakana(java.lang.String str)
          Translates this character into the equivalent Katakana character.
static java.lang.String toRomaji(java.lang.String str)
          Translates this character into the equivalent Romaji character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

private static final java.lang.String VERSION
Version information

See Also:
Constant Field Values

romaji

protected static java.lang.String[] romaji
The array used to map hirgana to romaji. Note the little ya, yu and yo characters need to follow a character in the voicedRomaji array.


voicedRomaji

protected static java.lang.String[] voicedRomaji
The array used to map hirgana to romaji. This is used when the character is followed by a little ya, yu, or yo.

Constructor Detail

JapaneseString

public JapaneseString()
Method Detail

isKana

public static boolean isKana(java.lang.String str)
Determines if this character is a Japanese Kana.


isHiragana

public static boolean isHiragana(java.lang.String str)
Determines if this character is one of the Japanese Hiragana.


isKatakana

public static boolean isKatakana(java.lang.String str)
Determines if this character is one of the Japanese Katakana.


isHalfwidthKatakana

public static boolean isHalfwidthKatakana(java.lang.String str)
Determines if this character is a Half width Katakana.


isFullwidthKatakana

public static boolean isFullwidthKatakana(java.lang.String str)
Determines if this character is a Full width Katakana.


isKanji

public static boolean isKanji(java.lang.String str)
Determines if this character is a Kanji character.


isRomaji

public static boolean isRomaji(java.lang.String str)
Determines if this character could be used as part of a romaji character.


toKatakana

public static java.lang.String toKatakana(java.lang.String str)
Translates this character into the equivalent Katakana character. The function only operates on Hiragana and always returns the Full width version of the Katakana. If the character is outside the Hiragana then the origianal character is returned.


toHiragana

public static java.lang.String toHiragana(java.lang.String str)
Translates this character into the equivalent Hiragana character. The function only operates on Katakana characters If the character is outside the Full width or Half width Katakana then the origianal character is returned.


toRomaji

public static java.lang.String toRomaji(java.lang.String str)
Translates this character into the equivalent Romaji character. The function only operates on Hiragana and Katakana characters If the character is outside the given range then the origianal character is returned. The resulting string is lowercase if the input was Hiragana and UPPERCASE if the input was Katakana.


lookupRomaji

private static java.lang.String lookupRomaji(char c)
Access the array to return the correct romaji string.