The amount to convert (can be a number or string).
If true
, converts the amount to English words. Default is false
(converts to Bangla words).
If true
, appends "Only." (English) or "মাত্র।" (Bangla) at the end. Default is false
.
If true
, skips the connector between Taka and Poisha. Default is false
.
The amount in words, with Taka and Poisha.
// Default behavior (Bangla, no suffix, with connector)
convertToTakaInWords(123.45); // "একশত তেইশ টাকা এবং পঁয়তাল্লিশ পয়সা"
convertToTakaInWords("১২৩.৪৫"); // "একশত তেইশ টাকা এবং পঁয়তাল্লিশ পয়সা"
convertToTakaInWords(1000); // "এক হাজার টাকা"
convertToTakaInWords("১০০০.০০"); // "এক হাজার টাকা"
// English words
convertToTakaInWords(123.45, true); // "One hundred twenty-three taka and forty-five poisha"
convertToTakaInWords("১২৩.৪৫", true); // "One hundred twenty-three taka and forty-five poisha"
convertToTakaInWords(1000, true); // "One thousand taka"
convertToTakaInWords("১০০০.০০", true); // "One thousand taka"
// With suffix
convertToTakaInWords(123.45, false, true); // "একশত তেইশ টাকা এবং পঁয়তাল্লিশ পয়সা মাত্র।"
convertToTakaInWords(123.45, true, true); // "One hundred twenty-three taka and forty-five poisha only."
convertToTakaInWords(1000, false, true); // "এক হাজার টাকা মাত্র।"
convertToTakaInWords(1000, true, true); // "One thousand taka only."
// Without connector
convertToTakaInWords(123.45, false, false, true); // "একশত তেইশ টাকা পঁয়তাল্লিশ পয়সা"
convertToTakaInWords(123.45, true, false, true); // "One hundred twenty-three taka forty-five poisha"
convertToTakaInWords(1000, false, false, true); // "এক হাজার টাকা"
convertToTakaInWords(1000, true, false, true); // "One thousand taka"
// With suffix and without connector
convertToTakaInWords(123.45, false, true, true); // "একশত তেইশ টাকা পঁয়তাল্লিশ পয়সা মাত্র।"
convertToTakaInWords(123.45, true, true, true); // "One hundred twenty-three taka forty-five poisha only."
convertToTakaInWords(1000, false, true, true); // "এক হাজার টাকা মাত্র।"
convertToTakaInWords(1000, true, true, true); // "One thousand taka only."
// Edge cases and error handling
convertToTakaInWords("১২৩.৪৫২"); // Throws error: "Poisha part cannot exceed 2 digits."
convertToTakaInWords("-123.45"); // Throws error: "Negative amounts are not allowed."
convertToTakaInWords("invalid"); // Throws error: "Invalid input: Input must be a valid number string."
Converts a number to its word representation in Taka and Poisha.