engToBan static method

String engToBan(
  1. dynamic inputValue
)

english to bangla engToBan converter method

Implementation

static String engToBan(inputValue) {
  //convert to string and make a list
  var strList = inputValue.toString().split('');
  //declare a list variable
  List<String> returnList = [];
  //loop on the list
  for (var str in strList) {
    //switch case to convert number and add to the list
    switch (str) {
      case "0":
        returnList.add("০");
        break;
      case "1":
        returnList.add("১");
        break;
      case "2":
        returnList.add("২");
        break;
      case "3":
        returnList.add("৩");
        break;
      case "4":
        returnList.add("৪");
        break;
      case "5":
        returnList.add("৫");
        break;
      case "6":
        returnList.add("৬");
        break;

      case "7":
        returnList.add("৭");
        break;
      case "8":
        returnList.add("৮");
        break;
      case "9":
        returnList.add("৯");
        break;
      default:
        returnList.add(str);
        break;
    }
  }
  //return all join list
  return returnList.join("");
}