unit XuStrUtils;
interface
Uses SysUtils, StrUtils;
Function IntToEnStr(Value: Integer): String; // Convert Integer to English
Function FloatToEnStr(Value: Extended; digit: Integer=2): String; // Convert float to English
Function FTFormatDate(DateTime: TDateTime): String; //Convert Date to [EnglishMonthName dd, yyyy]
implementation
Uses Math, XuFuncLib;
Const
// Ones: Array[0..9] of String=('' ZERO'','' ONE'','' TWO'','' THREE'','' FOUR'','' FIVE'','' SIX'','' SEVEN'','' EIGHT'','' NINE'');
// Teens : Array [0..9] of String = ('' TEN'','' ELEVEN'', '' TWELVE'','' THIRTEEN'','' FOURTEEN'','' FIFTEEN'','' SIXTEEN'','' SEVENTEEN'','' EIGHTEEN'','' NINETEEN'');
OneToTeens: Array[0..19] of String=('' ZERO'','' ONE'','' TWO'','' THREE'','' FOUR'','' FIVE'','' SIX'','' SEVEN'','' EIGHT'','' NINE'',
'' TEN'','' ELEVEN'','' TWELVE'','' THIRTEEN'','' FOURTEEN'','' FIFTEEN'','' SIXTEEN'','' SEVENTEEN'','' EIGHTEEN'','' NINETEEN'');
Tens: Array[0..9] of String =('' ZERO'','' TEN'','' TWENTY'','' THIRTY'','' FORTY'','' FIFTY'','' SIXTY'','' SEVENTY'','' EIGHTY'','' NINETY'');
Thousands:Array[1..4] of String = ('' '', '' THOUSAND'','' MILLION'','' BILLION'');
DotName = '' DOT'';
HUNDREDName ='' HUNDRED'';
MaxDigit = 12;
Type
Str3 = String;
Function HunderdToEnStr(ns: Str3): String; //Call by IntToEnStr
Var
i: integer;
tmpStr: String;
begin
Result:='''';
for i:=1 to 3 do
begin
case i of
1: case ns of
''1''..''9'': tmpStr:= OneToTeens[StrToInt(ns)]+ HUNDREDName;
else
tmpStr:='''';
end;
2: case ns of
''2''..''9'': tmpStr:= Tens[StrToInt(ns)];
''1'': tmpStr:=OneToTeens[StrToInt(ns+ns)];
else
tmpStr:='''';
end;
3: case ns of
'' '',''0'', ''2''..''9'': if ns<>''0'' then
&nb