Topic: please help make example this code

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.

Re: please help make example this code

Example, how to convert amount to words using script, but in english, you can translate it himself.

Post's attachments

Attachment icon ToWords by script.zip 8.48 kb, 703 downloads since 2015-03-19 

Dmitry.

Re: please help make example this code

Thank you for your example to use script to convert amount to word. But maximum only can convert Billion, It can not work with Trillion?
How can I make it work with amounts as Trillion? Please help

Re: please help make example this code

Unfortunately Trillions are not supported.

Dmitry.

Re: please help make example this code

Thank you very much for your answer. If in case using your software in some country need to using more than billion (Ex: 50 Billion) how to change in your script?

Re: please help make example this code

For more detail my question: I am try to use function ToWords(value: real; currencyName: string = ''usd''), it work very well even amount 50 billion in English. But because I need to translate to other language therefore I try to use your script, in that case if amount more than 2 billion then the script will work not correct. How to change in your script? Thank you in advance for your advise.

Re: please help make example this code

Hello.


Please let me know which language you need, I will try yo add it.

Dmitry.

Re: please help make example this code

Thank you very much. I want to translate to Vietnamese language. I try to add 1 billion, 2 billion then result running is correct, but if I add 3 billion then result come out is not correct. Please help me to check.

function HundredAtATime(TheAmount: Extended): string;
begin
  Result := '';
  TheAmount := Abs(TheAmount);
  while TheAmount > 0 do
  begin
      if TheAmount >= 2000000000 then                 /// Note: If input more than 2,2 billion then program not running correct
    begin
      Result := Result + 'Hai tỷ ';
      TheAmount := TheAmount - 2000000000;
    end;
      if TheAmount >= 1000000000 then
    begin
      Result := Result + 'Một tỷ ';
      TheAmount := TheAmount - 1000000000;           ///I try to increase more than 1 billion, from 1 biilion to 2,2 billion program runing Ok
    end;

    if TheAmount >= 900 then
    begin
      Result := Result + 'Chín trăm ';
      TheAmount := TheAmount - 900;
    end;
....

Post's attachments

Attachment icon ToWords by script_VN.rar 296.99 kb, 491 downloads since 2017-02-22 

Re: please help make example this code

Hoang
Unfortunately I can't help you, because you use cracked version of application.

Dmitry.