หน้าแรก
 การบ้าน
  C/C++ new
  Java new
  Windows Phone
  แจ้งเรื่องที่ต้องการ
 บทความ
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 แบบเรียนฟรี
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 ซอร์สโค้ด
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 บริการจากเรา
  เปิดท้าย... ขายโค้ด
  Freeware
  อัตราค่าโฆษณา
  รายชื่อลูกค้า
  สถิติผู้เข้าเว็บ
 ดาว์นโหลด
 ค้นหาข้อมูล
 กระดานสนทนา
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
  อื่นๆ
 กระดานงาน
 ลิงค์เว็บ
 เกี่ยวกับผม
 อัตราค่าโฆษณา
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
โปรแกรมเบอร์ดี (BerDee)
โปรแกรมเบอร์ดี (Android)
เกมส์เป่ายิ้งฉุบ
เกมส์เป่ายิ้งฉุบ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ติดต่อสอบถามมาได้ตลอดนะ...
2015-07-29 13:35:58
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:33:54
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:32:51
  ติดต่อสอบถามเข้ามาได้นะ...
2014-01-06 12:47:38
  ถ้ายังหาคนสอนไม่ได้ ก็ลอ...
2013-07-06 01:04:37
  สนใจส่งขอบเขตมาคุยราคาก...
2013-03-24 18:54:20
  ถ้ายังไม่มีคนรับงานติดต...
2012-12-16 19:18:14
  สนใจคะ ติดต่อ 0905076277...
2012-11-12 11:07:46
  รับทำโปรเจ็คนักศึกษาหรื...
2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  เขียนโปรแกรมภาษาจาวา
1.โ...

2023-09-12 11:40:28
  ต้องลอง debug ดูเองครับ
ไล่...

2023-06-08 18:03:06
  ร้านค้าแห่งหนึ่ง จะต้องน...
2021-09-21 08:47:08
  จงเขียนโปรแกรมดำเนินการ...
2021-05-07 15:06:11
  จงเขียนโปรแกรมสำหรับคำน...
2021-03-09 14:21:45
  ขอดู...
2021-01-04 23:56:45
  ขอโค้ดเพื่อทำการเรียนกา...
2020-12-09 23:02:09
  แล้ว ?...
2020-12-09 10:56:34
  จ้า...
2020-10-18 16:53:21
  พอดีผมเหลื่อแค่ตัดสต๊อก...
2020-05-31 21:49:43
  Homework comment
  เขียนโปรแกรมเพื่อรับค่า...
2022-02-24 10:45:17
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  โจทย์การบ้าน c++ เขียนรูปแ...
2020-04-06 11:01:33
  แบบนี้ขอเป็น ภาษา php หน่อย...
2019-09-18 14:36:34
  ผมไม่อยากให้คุณได้คะแนน...
2019-04-27 01:29:07
  อาจารย์เขาบอกแนวข้อสอบม...
2019-04-27 00:44:29
  ขอสอบถามการเขียน c++ ครับ เ...
2018-04-02 12:19:21
  โค้ดตัวอย่างศึกษาให้เข้...
2017-11-26 14:50:05
  คำนวณค่าน้ำโดยรับค่ามิเ...
2017-11-20 23:15:26
  Article comment
  เท่าที่อ่าน error คือพื้นที่...
2022-03-23 13:56:48
  เรียน สอบถามปัญหา กับ อ.คร...
2022-01-24 17:39:49
  ต้องการ ให้เขียน โปรแกรม ...
2019-12-09 11:39:58
  รับเขียน arx จาก vc++ 2017 ล็อคโปร...
2019-09-19 09:48:09
  ทำการ register ไฟล์ที่ชื่อ mswinsck.oc...
2019-09-17 14:05:56
  ใน vb 6 ไม่มี component winsock เลยค่ะ ส...
2019-09-03 10:31:02
  รบกวนขอสอบถามหน่อยนะครั...
2019-03-04 05:31:04
  สามารถนำตัวหนังสือจากภา...
2018-12-25 08:54:32
  มีcode ของ VB ไหมค่ะ ถ้ามีรบกว...
2017-09-28 16:50:02
  น่าจะได้ครับ ไม่เคยลอง
...

2017-07-11 09:59:35
  9Mcode comment

Link Exchange

อัตราค่าโฆษณา
 
 Webboard

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

กระทู้ #3342 [Delphi] (จาก IP: 180.183.159.94)

โปรแกรมเปลียนตัวเลขเป็นภาษาไทย Delphi 7 [ขอความช่วยเหลือ]

ใครพอจะมีแนวทางไหมครับเช่น
120 = หนึ่งร้อยยี่สิบ
จากคุณ : Zen13 / i3enz_zen13@hotmail.com [2012-09-10 17:31:46]  

58.11.86.162 ความคิดเห็น #28676 (จาก IP: 58.11.86.162)
ลองศึกษาแล้วเอามาแปลงเอง

------------------Cut----------------------------------
function ToWords (num : extended; wand, usd : boolean) : string;
{ this converts currency to words }
{ BOOLEAN PARAMETERS
wand : if true use "and", if not don't
usd : if true US Dollars, if not GB Pounds }
const
units : array[1..9] of string[6] = ('one ','two ','three ','four ','five
',
'six ','seven ','eight ','nine ');
tens : array[2..9] of string[8] = ('twenty ','thirty ','forty ','fifty
',
'sixty ','seventy ','eighty ','ninety ');
teens : array[0..9] of string[10] = ('ten ','eleven ','twelve
','thirteen ',
'fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen
');
sep = ['.',','];
var
i : byte;
bit : string[3];
base : string[15];
chunk, resstr : string;
andflag : boolean;
numstrings, lastcopy : integer;
bits : tstringlist;
curr, curr1, pennies : string[8];
penniesbit : string[12];
which : array[0..2] of string[9];
procedure dochunk(ch : string; pass : byte);
var
tflag : boolean;
i : byte;
pt : array[1..3] of integer;
begin
chunk:='';
tflag:=false;
if ch='000' then
if (resstr <> '') and (pass=2) then begin
chunk:= curr;
exit;
end else exit;
for i:=1 to 3 do pt[i]:=strtoint(ch[i]);
if pt[1] <> 0 then chunk:=chunk+ units[pt[1]] + 'hundred ';
if wand then begin
if (copy(ch,2,2) <> '00') then
if andflag or (chunk <> '') then chunk:=chunk + 'and ';
end;
if pt[2] <> 0 then begin
if pt[2] > 1 then
chunk:=chunk + tens[pt[2]]
else tflag:=true;
end;
if tflag then begin
chunk:= chunk + teens[pt[3]]
end else if pt[3] <> 0 then chunk:=chunk + units[pt[3]];
if (pass = 2) and (resstr='') and (chunk='one ') then
chunk:=chunk + curr1
else chunk:=chunk + which[pass];
andflag:=true;
end;
begin { ToWords }
which[0]:='million ';
which[1]:='thousand ';
if usd then begin
curr:='dollars ';
curr1:='dollar ';
pennies:=' cents';
end else begin
curr:='pounds ';
curr1:='pound ';
pennies:=' pence';
end;
which[2]:=curr;
chunk:='';
resstr:='';
base:=formatfloat('000,000,000.00',num);
try
bits:=tstringlist.create;
lastcopy:=1;
for i := 1 to length(base) do
if (base[i] in sep) or (i=length(base)) then begin
bit:=copy(base,lastcopy,i-lastcopy);
if i= length(base) then bit:=bit + base[i];
numstrings:=bits.add(bit);
lastcopy:=i+1;
end;
andflag:=false;
for i:= 0 to 2 do begin
dochunk(bits[i],i);
resstr:=resstr + chunk;
chunk:='';
end;
if usd then penniesbit:='and ' + bits[3] + ' cents'
else penniesbit:=bits[3];
if bits[3] <> '00' then begin
if resstr='' then resstr:=bits[3] + pennies
else resstr:=resstr + penniesbit;
end;
if resstr <> '' then resstr[1]:=upcase(resstr[1]);
result:=resstr;
finally
bits.free;
end;
end; { ToWords }
---------------------------Cut--------------------------
Hope it helps
Nick Spurrier (MoDESoft, UK)
จากคุณ : maddog [2012-09-13 10:42:49]

111.84.212.190 ความคิดเห็น #28999 (จาก IP: 111.84.212.190)
ลองเอา code การหาค่าเงินบาท ที่ผมเขียนใน Lazarus ไปประยุกต์ใช้ดูครับ

------------Code----------------

function TThai.TextBaht(extBaht:Currency):string;
var
strBaht, strStang, strTmpBaht, strTmpStang : string;
n, i : integer;
isCredit : boolean;
const
kLuk : array [1..15] of string =
('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน','สิบ','ร้อย','พัน','หมื่น','แสน','ล้านๆ','สิบ','ร้อย');
kNum : array [0..9] of string =
('','หนึ่ง','สอง','สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า');
begin
Result := '';
isCredit := false;
n := 0;

strBaht := FormatFloat('0.00',extBaht); // แปลงเลขเป็นสตริงก์
n := Pos('.',strBaht); // หาตำแหน่งจุด

if extBaht < 0 then begin //ถ้าค่าเป็นลบ
// ค่าเงินเป็นลบ
isCredit := true;
strStang := Copy(strBaht,n+1,2); // หาเลขสตางค์
strBaht := Copy(strBaht,2,n-2); // หาเลขบาท
end else begin
// ค่าเงินเป็นบวก
isCredit := false;
strStang := Copy(strBaht,n+1,2); // หาเลขสตางค์
strBaht := Copy(strBaht,1,n-1); // หาเลขบาท
end;

(*
// คิดเฉพาะค่าเป็นบวกเท่านั้น
strStang := Copy(strBaht,n+1,2); // หาเลขสตางค์
strBaht := Copy(strBaht,1,n-1); // หาเลขบาท
*)


// หาบาท
strTmpBaht := '';
i := Length(strBaht);
for n := 1 to Length(strBaht) do
begin
// ถ้าเป็นเลข 0
if (strBaht[n]='0') then
begin
// ถ้าเป็นหลักล้าน และ มีเงินตั้งแต่ล้านขึ้นไปให้เติมคำว่า ล้าน
if (i=7) and (strTmpBaht<>'') then strTmpBaht := strTmpBaht + kLuk[i];
Dec(i); // คือ i := i - 1;
Continue; // ข้ามการทำงาน
end;
// บวกจำนวนเงินเข้าไปตามหลัก
strTmpBaht := strTmpBaht + kNum[StrToInt(strBaht[n])] + kLuk[i];
Dec(i);
end;

// ถ้ามียอดเงินให้เพิ่มคำว่า บาท
if (strTmpBaht <> '') then strTmpBaht := strTmpBaht + 'บาท';

// หาสตางค์
strTmpStang := '';
// ถ้ามีค่าตั้งแต่ 10 สตางค์ขึ้นไป
if (strStang[1]<>'0') then // สิบ
strTmpStang := strTmpStang + kNum[StrToInt(strStang[1])] + kLuk[2];
// ถ้ามีค่าสตางค์
if (strStang[2]<>'0') then // หน่วย
strTmpStang := strTmpStang + kNum[StrToInt(strStang[2])];

// ถ้ามีค่าหน่วยสตางค์ ให้เติมคำว่า สตางค์
if (strTmpStang<>'') then
begin
strTmpStang := strTmpStang + 'สตางค์';
strTmpBaht := strTmpBaht + strTmpStang; // รวมบาทสตางค์
end
else if (strTmpBaht<>'') then // แต่ถ้ามีค่าเงินบาทให้เติม ถ้วน
strTmpBaht := strTmpBaht + 'ถ้วน';

// โยกย้ายคำเรียกหน่วยนับ
if (strTmpBaht<>'') then
begin

strTmpBaht := StringReplace(strTmpBaht,'หนึ่งสิบ','สิบ',[rfReplaceAll]);
strTmpBaht := StringReplace(strTmpBaht,'สองสิบ','ยี่สิบ',[rfReplaceAll]);
strTmpBaht := StringReplace(strTmpBaht,'สิบหนึ่ง','สิบเอ็ด',[rfReplaceAll]);


// เห็นใช้กันได้ทั้งสองแบบ ร้อยหนึ่ง ร้อยเอ็ด
//strTmpBaht := StringReplace(strTmpBaht,'ร้อยหนึ่ง','ร้อยเอ็ด',[rfReplaceAll]);
if isCredit then
Result := '(ติดลบ) ' + strTmpBaht
else
Result := strTmpBaht;
end;
end;
------------จบ----------------
จากคุณ : M-29 / m29@gmail.com [2014-01-31 19:21:41]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ webmaster@sourcecode.in.th
  • ห้ามใช้คำหยาบและคำพูดที่ไม่เหมาะสม
  • ขอสงวนสิทธิหากตรวจพบ ข้อความที่ไม่เหมาะสม ข้อความนั้นจะถูกลบทันที
ชื่อ
อีเมล์
รายละเอียด

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

 
 
คลิปสอนเขียนโปรแกรม
เรียนเขียนโปรแกรมดอทเน็ต
เรียนเขียนโปรแกรมแอนดรอยด์
เรียนเขียนโปรแกรมเบล็คเบอร์รี่
เรียนเขียนโปรแกรมซี ซีพลัสพลัส
เรียนเขียนโปรแกรมจาวา
เรียนการใช้งานลินุกส์
เรียนการเขียนโปรแกรมวินโดว์โฟน
เรียนการเขียนโปรแกรมพีเฮชพี มายเอสคิวเอล
อัตราค่าโฆษณา
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
แบบสำรวจ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

สงวนลิขสิทธิ์ ห้ามคัดลอก ทำซ้ำ แก้ไข ดัดแปลง ไม่ว่าในรูปแบบใด โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษร
เลขทะเบียนพาณิชย์อิเล็กทรอนิกส์จากกระทรวงพาณิชย์: 7100503002000
Copyright 2001 SourceCode.in.th