Class Utils


  • public class Utils
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Utils.ChineseDigits  
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String chineseNumber​(long n, Utils.ChineseDigits zh)
      Interesting features of chinese numbers: - Each digit is followed by a unit symbol (10's, 100's, 1000's).
      static java.util.Locale localeFromString​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • localeFromString

        public static final java.util.Locale localeFromString​(java.lang.String s)
      • chineseNumber

        public static java.lang.String chineseNumber​(long n,
                                                     Utils.ChineseDigits zh)
        Interesting features of chinese numbers: - Each digit is followed by a unit symbol (10's, 100's, 1000's). - Units repeat in levels of 10,000, there are symbols for each level too (except 1's). - The digit 2 has a special form before the 10 symbol and at the end of the number. - If the first digit in the number is 1 and its unit is 10, the 1 is omitted. - Sequences of 0 digits and their units are replaced by a single 0 and no unit. - If there are two such sequences of 0 digits in a level (1000's and 10's), the 1000's 0 is also omitted. - The 1000's 0 is also omitted in alternating levels, such that it is omitted in the rightmost level with a 10's 0, or if none, in the rightmost level. - Level symbols are omitted if all of their units are omitted