Topic: i need script in form NUMER to TEXT.

helloo.

i need say about script change text and read number to word For example, 2325 will be two thousand three hundred and twenty five
couse there some people say me and need this for accounting...please read my notes.

I SAW component  in fast report . but iwant in form.

THANKS.

Re: i need script in form NUMER to TEXT.

Example for you:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
     if ValidFloat(Form1.Edit1.Text) then
         Form1.Edit2.Text:=ToWords(StrToFloat(Form1.Edit1.Text), '', 0 , False);
end;
Post's attachments

Attachment icon ToWords.zip 2.5 kb, 492 downloads since 2015-03-17 

Dmitry.

3 (edited by megood70 2015-03-17 21:05:42)

Re: i need script in form NUMER to TEXT.

thanks for answer .... i dont know this is working on software my visual database but i  need code like this:
if this code working on software please help me i need make like this my software project...in link file zip i think all code

function conv2(x:integer):string;forward;
function conv3(x:integer):string;forward;

{***********Fonction_1*************}

function conv1(x:integer):string;
var temp:string;
begin
if (x>19) and (x<100) then conv2(x)
else if (x>100) then conv3(x)
else begin

case x of
1:temp:='un ';
2:temp:='deux ';
3:temp:='trois ';
4:temp:='quatre ';
5:temp:='cinq ';
6:temp:='six ';
7:temp:='sept ';
8:temp:='huit ';
9:temp:='neuf ';
10:temp:='dix ';
11:temp:='onze ';
12:temp:='douze ';
13:temp:='treize ';
14:temp:='quatorze ';
15:temp:='quinze ';
16:temp:='seize ';
17:temp:='dix sept ';
18:temp:='dix huit ';
19:temp:='dix neuf ';
end;
conv1:=temp;
end;
end;

Post's attachments

Attachment icon numtowords.zip 1.08 kb, 477 downloads since 2015-03-17 

4 (edited by mr_d 2015-03-18 00:23:51)

Re: i need script in form NUMER to TEXT.

If you need it to be in another language, then assuming that the structure of numbers as words is the same as for English, then I would use a combination of what Dmitry has given as the function ReplaceStr.

e.g. something similar to the below code snippet:

var
strNumber: string;
strNumberAsWords: string;

begin
strNumber := '123456';
ShowMessage(strNumber);
strNumberAsWords := ToWords(StrToFloat(strNumber), '', 0, False);
strNumberAsWords := Lowercase(strNumberAsWords);
ShowMessage(strNumberAsWords);
strNumberAsWords := ReplaceStr(strNumberAsWords, 'one', 'un');
//...2 to 8
strNumberAsWords := ReplaceStr(strNumberAsWords, 'nine', 'neuf');
//...11 to 18
strNumberAsWords := ReplaceStr(strNumberAsWords, 'nineteen', 'dix neuf');
//...more for 10, 20, 30, 40, 50, 60 70, 80, 90
//...more for hundred, thousand, million, billion, etc.
ShowMessage(strNumberAsWords);
end.

you may have to fiddle around a bit to get an accurate translated version though.

Dennis

5 (edited by megood70 2015-03-18 09:20:56)

Re: i need script in form NUMER to TEXT.

yes i need like this code working on my visual database ... couse i want translate words to another language   that make me i need that code please send for me all code change number to words . from one to milion. for accounting i need or make for me sample example on soft ......thank you

example :
1 = واحد
2= اثنان
12= اثنا عشر
......more