This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
import java.time.Instant; | |
final class N2WHindi { | |
// "शून्य" | |
private static final String[] zeroTo99 = { "", "एक", "दो", "तीन", "चार", "पाँच", "छः", "सात", "आठ", "नौ", "दश", | |
"ग्यारह", "बारह", "तेरह", "चौदह", "पन्द्रह", "सोलह", "सत्रह", "अठारह", "उन्नीस", "बीस", "इक्कीस", "बाईस", | |
"तेईस", "चौबीस", "पच्चीस", "छब्बीस", "सत्ताईस", "अट्ठाईस", "उनतीस", "तीस", "इकतीस", "बत्तीस", "तैंतीस", | |
"चौंतीस", "पैंतीस", "छत्तीस", "सैंतीस", "अड़तीस", "उनतालीस", "चालीस", "इकतालीस", "बयालीस", "तैंतालीस", | |
"चौवालीस", "पैंतालीस", "छियालीस", "सैंतालीस", "अड़तालीस", "उनचास", "पचास", "इक्यावन", "बावन", "तिरपन", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class N2WHindi { | |
// "शून्य" | |
private static readonly zeroTo99: string[] = | |
'|एक|दो|तीन|चार|पाँच|छः|सात|आठ|नौ|दश|ग्यारह|बारह|तेरह|चौदह|पन्द्रह|सोलह|सत्रह|अठारह|उन्नीस|बीस|इक्कीस|बाईस|तेईस|चौबीस|पच्चीस|छब्बीस|सत्ताईस|अट्ठाईस|उनतीस|तीस|इकतीस|बत्तीस|तैंतीस|चौंतीस|पैंतीस|छत्तीस|सैंतीस|अड़तीस|उनतालीस|चालीस|इकतालीस|बयालीस|तैंतालीस|चौवालीस|पैंतालीस|छियालीस|सैंतालीस|अड़तालीस|उनचास|पचास|इक्यावन|बावन|तिरपन|चौवन|पचपन|छप्पन|सत्तावन|अट्ठावन|उनसठ|साठ|इकसठ|बासठ|तिरसठ|चौंसठ|पैंसठ|छियासठ|सड़सठ|अड़सठ|उनहत्तर|सत्तर|इकहत्तर|बहत्तर|तिहत्तर|चौहत्तर|पचहत्तर|छिहत्तर|सतहत्तर|अठहत्तर|उन्यासी|अस्सी|इक्यासी|बयासी|तिरासी|चौरासी|पचासी|छियासी|सत्तासी|अट्ठासी|नवासी|नब्बे|इक्यानबे|बानबे|तिरानबे|चौरानबे|पंचानबे|छियानबे|सत्तानबे|अट्ठानबे|निन्यान्बे'.split( | |
'|' | |
); | |
private static readonly place: string[] = 'हज़ार|लाख|करोड़|अरब|खरब|नील'.split('|'); | |
public static convert(x: string): string { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nw=((e,n="Eigh",t=e=>e.split(/(?=[A-Z])|,/),i=(e,n)=>e.map(e=>e+n),r=t(`,OneTwoThreeFourFiveSixSevenEightNine`),o=["",,...i(["Twen",e="Thir","For",...n=["Fif",r[6],r[7],n,r[9]]],"ty")],u=["Ten","Eleven","Tweleve",...i([e,r[4],...n],"teen")],T=[n="","Thousand ",...i([...t("MBTrQuadrQuintSextSeptOctNonDec"),...i(e=t("UnDuoTreQuattuorQuinSexSeptenOctoNovem"),"dec"),...i(["V",...i(e,"v"),"Tr","Untr","Duotr"],"igint")],"illion ")])=>(i,l=(i+=n).length,d=0)=>[...i].reduce((v,S,c)=>(e=l-c,v+=(e+1)%3?(t=d?(d=0,u[S]):r[S],t&&t+" ")+((e+2)%3&&+S?"Hundred ":n):1==S?(d=1,n):o[S]&&o[S]+" ",v+=T[(t=e-1)%3==0?(+i[c-2]||+i[c-1]||+S)&&t/3:0]),n).trim()||"Zero")(); |