Evet, tam olarak bu amaçla yapılmış bir jQuery plug-in called Word Math yazdım. Sorunuzun, sadece kopyalayıp bu kodu
alert($.wordMath("four thousand and three").add("seven thousand and twenty nine"));
//alerts "eleven thousand thirty two"
ve işte yapıştırabilirsiniz Örneğin
! Biraz kelime matematik yaptın.
Kelime Matematik da tersi kelimeleri ve yardımcısı JavaScript numaralarından gelen dönüştürme yapabilirsiniz:
$.wordMath.toString(65401.90332)
// sixty five thousand four hundred one and nine tenths and three thousandths and three ten thousandths and two hundred thousandths
$.wordMath("three million four hundred and sixty seven thousand five hundred and forty two").value
// 3467542
You can read more about how to use the Word Math plugin on its readme page
DÜZENLEME: şimdi jQuery bağlı değildir Kelime Math bir sürümü var. Kullanmak için, wordMath.jquery.js
dosyasının yerine 0H32 deposunun wordMath.vanilla.min.js
dosyasını indirmelisiniz.
jQuery'siz sürümün kullanımı, aramalarda $.
önekine ihtiyacınız olmaması dışında jQuery sürümü ile tam olarak aynıdır. yerine
$.wordMath("fifteen").add("eighteen")
yapmanın diğer bir deyişle, yerine
wordMath("fifteen").add("eighteen")
evet, muhtemelen var. ne denedin –
SO sormadan denedim ... hayır şans henüz. – Daniel
haha ... parlak –