|
|
|
รบกวนสอบถามแนวคิดการใส่ค่าตัวเลขแล้วออกผลมาเป็นตัวหนังสือหน่อยครับ |
|
|
|
|
|
|
|
Code (JavaScript)
function Text(Number)
{
var TxtNumArr = new Array ("ศูนย์", "หนึ่ง", "สอง", "สาม", "สี่", "ห้า", "หก", "เจ็ด", "แปด", "เก้า", "สิบ");
var TxtDigitArr = new Array ("", "สิบ", "ร้อย", "พัน", "หมื่น", "แสน", "ล้าน");
var Text = "";
if (Number[1].length > 0)
{
Number[1] = Number[1].substring(0, 2);
}
var NumberLen = Number[0].length - 0;
for(var i = 0; i < NumberLen; i++)
{
var tmp = Number[0].substring(i, i + 1) - 0;
if (tmp != 0)
{
if ((i == (NumberLen - 1)) && (tmp == 1))
{
Text += "เอ็ด";
} else
if ((i == (NumberLen - 2)) && (tmp == 2))
{
Text += "ยี่";
} else
if ((i == (NumberLen - 2)) && (tmp == 1))
{
Text += "";
} else
{
Text += TxtNumArr[tmp];
}
Text += TxtDigitArr[NumberLen - i - 1];
}
}
return Text;
พอได้ไหมครับ
|
|
|
|
|
Date :
2015-06-24 00:00:40 |
By :
yutthanagorn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|