@Test public void cardinalTest2() { Assert.assertEquals("sıfır", TurkishNumbers.convertNumberToString("0")); Assert.assertEquals("sıfır sıfır", TurkishNumbers.convertNumberToString("00")); Assert.assertEquals("sıfır sıfır sıfır", TurkishNumbers.convertNumberToString("000")); Assert.assertEquals("sıfır sıfır sıfır bir", TurkishNumbers.convertNumberToString("0001")); Assert.assertEquals("bin", TurkishNumbers.convertNumberToString("1000")); Assert.assertEquals("bir", TurkishNumbers.convertNumberToString("1")); Assert.assertEquals("on bir", TurkishNumbers.convertNumberToString("11")); Assert.assertEquals("yüz on bir", TurkishNumbers.convertNumberToString("111")); Assert.assertEquals("yüz on bir bin", TurkishNumbers.convertNumberToString("111000")); Assert.assertEquals("sıfır yüz on bir bin", TurkishNumbers.convertNumberToString("0111000")); Assert.assertEquals("sıfır sıfır yüz on bir bin", TurkishNumbers.convertNumberToString("00111000")); }
public static String convertNumberToString(String input) { if (input.startsWith("+")) { input = input.substring(1); } List<String> sb = new ArrayList<>(); int i; for (i = 0; i < input.length(); i++) { if (input.charAt(i) == '0') { sb.add("sıfır"); } else { break; } } String rest = input.substring(i); if (rest.length() > 0) { sb.add(convertToString(Long.parseLong(rest))); } return String.join(" ", sb); }
TurkishNumbers { public static String convertNumberToString(String input) { if (input.startsWith("+")) { input = input.substring(1); } List<String> sb = new ArrayList<>(); int i; for (i = 0; i < input.length(); i++) { if (input.charAt(i) == '0') { sb.add("sıfır"); } else { break; } } String rest = input.substring(i); if (rest.length() > 0) { sb.add(convertToString(Long.parseLong(rest))); } return String.join(" ", sb); } }
TurkishNumbers { public static String convertNumberToString(String input) { if (input.startsWith("+")) { input = input.substring(1); } List<String> sb = new ArrayList<>(); int i; for (i = 0; i < input.length(); i++) { if (input.charAt(i) == '0') { sb.add("sıfır"); } else { break; } } String rest = input.substring(i); if (rest.length() > 0) { sb.add(convertToString(Long.parseLong(rest))); } return String.join(" ", sb); }  }
TurkishNumbers { public static String convertNumberToString(String input) { if (input.startsWith("+")) { input = input.substring(1); } List<String> sb = new ArrayList<>(); int i; for (i = 0; i < input.length(); i++) { if (input.charAt(i) == '0') { sb.add("sıfır"); } else { break; } } String rest = input.substring(i); if (rest.length() > 0) { sb.add(convertToString(Long.parseLong(rest))); } return String.join(" ", sb); }  static Map<String, String> getOrdinalMap(); static String convertToString(long input); static String convertNumberToString(String input); static long singleWordNumberValue(String word); static List<String> replaceNumberStrings(List<String> inputSequence); static List<String> seperateConnectedNumbers(List<String> inputSequence); static List<String> seperateConnectedNumbers(String input); static long convertToNumber(String... words); static long convertToNumber(String text); static String convertOrdinalNumberString(String input); static List<String> separateNumbers(String s); static String getOrdinal(String input); static boolean hasNumber(String s); static boolean hasOnlyNumber(String s); static int romanToDecimal(String s); }
TurkishNumbers { public static String convertNumberToString(String input) { if (input.startsWith("+")) { input = input.substring(1); } List<String> sb = new ArrayList<>(); int i; for (i = 0; i < input.length(); i++) { if (input.charAt(i) == '0') { sb.add("sıfır"); } else { break; } } String rest = input.substring(i); if (rest.length() > 0) { sb.add(convertToString(Long.parseLong(rest))); } return String.join(" ", sb); }  static Map<String, String> getOrdinalMap(); static String convertToString(long input); static String convertNumberToString(String input); static long singleWordNumberValue(String word); static List<String> replaceNumberStrings(List<String> inputSequence); static List<String> seperateConnectedNumbers(List<String> inputSequence); static List<String> seperateConnectedNumbers(String input); static long convertToNumber(String... words); static long convertToNumber(String text); static String convertOrdinalNumberString(String input); static List<String> separateNumbers(String s); static String getOrdinal(String input); static boolean hasNumber(String s); static boolean hasOnlyNumber(String s); static int romanToDecimal(String s); static final long MAX_NUMBER; static final long MIN_NUMBER; }