convert static method
handle converter
Implementation
static String convert(String number) {
var value = "";
RegExp numeric = RegExp(r'^-?[0-9]+$');
if (numeric.hasMatch(number) && number.length <= 14) {
switch (number.toString().length) {
case 1:
value = Options().oneTen(number);
break;
case 2:
value = Options().oneTen(number);
break;
case 3:
value = Options().hundred(number);
break;
case 4:
case 5:
case 6:
value = Options().thousand(number);
break;
case 7:
case 8:
case 9:
value = Options().million(number);
break;
case 10:
case 11:
case 12:
value = Options().billion(number);
break;
case 13:
case 14:
case 15:
value = Options().trillion(number);
break;
}
}
return value
.replaceAll("وصفر", "")
.replaceAll("وundefined", "")
.replaceAll("صفر و", "")
.replaceAll("صفر", "")
.replaceAll("مائتا أ", "مئتان أ")
.replaceAll("مائتا م", "مئتان م");
}