Gold amount uppercase conversion

zhaozj2021-02-16  48

Because I can't find the relevant function, I wrote one, which is the imitation Excel amount conversion, the unlimited amount.

Const Numberay: array [0..9] of string = ('zero', '壹', '', '', '', 'Wu', 'Lu', '柒', '捌', '');

// Digital Transfer and capital Function GetMoneyswitch (amoney: string): String;

// Remove all separators Procedure Clearcomma (VAR Avalue: String); Begin While Pos (', Avalue)> 0 Do Delete (Avalue, POS (', ', Avalue), 1); END

// Test if zero will not return value FUNCTION FiltrateValue (const avalue, astr: string): string; var intValue: integer; begin intValue: = startdef (avalue, 0); if IntValue> 0 Then Result: = astr; end ;

// number translation directly uppercase function Direct (const AValue: string): string; var ResultStr: string; iCount: Integer; begin for iCount: = 1 to Length (AValue) do ResultStr: = ResultStr NumberArray [StrToInt (AValue [iCount])]; result: = resultStr; End;

// Translate four lengths of numbers with capital Function Fourbit (const avalue: string): string; varI, x, j: integer; intValue: integer; resultStr: string; begin

INTVALUE: = STRTOINTDEF (Avalue, 0); x: = INTVALUE;

I: = x Div 1000; J: = X MOD 1000; IF i <> 0 Then Resultstr: = NumberRay [i] '仟' else begin if longth (avalue)> 3 Then Resultstr: = 'zero;

I: = J Div 100; J: = J MOD 100; IF i <> 0 Then Resultstr: = Resultstr NumberRay [i] '' Else Begin If (Resultstr <> ') And (Length (Avalue)> 2) And (resultstr, longth (resultststr) -1, 2) <> 'zero').........................

I: = J DIV 10; J: = J MOD 10; IF i <> 0 Then Resultstr: = ResultStr NumberRay [i] 'Picking' Else Begin if (Resultstr <> ') And (Length (Avalue)> 1) AND (Copy (ResultStr, Length (Resultstr) -1, 2) <> 'zero') Then Resultstr: = Resultstr 'zero'; End; Resultstr: = Resultstr NumberRay [J];

While Copy (Resultstr, Length (Resultstr) -1, 2) = 'zero' Do Delete (Resultstr, Length (Resultstr) -1, 2);

RESULT: = resultStr; End;

VAR Integerue: String; // The value of the integer part of the value kilomegavalue: String; // Storage Digital AccountValue: String; // In Gigabit Some Decimalue: String; // There is a value after the decimal point

Resultkilomega: String; // Big Higher Strong and translated uppercase character Resultaccount: String; // In Gigabit, the integer part of Gigabit and translated uppercase characters ResultDecimal: string; // Decimal value and translated upper-write characters

FourBitstr: String; // Maximum fourth-digit character begin

// Remove the separator Clearcomma (Amoney);

// Verify whether the string is legal try Amoney: = floattostr (STRTOFLOAT (Amoney)); Except Raise Exception.create ('invalid numerical string');

// Remove the value of the small data point // Remove the value of the integer part IF POS ('.', Amoney)> 0 THEN BEGIN DECIMALVALUE: = COPY (Amoney, POS ('.', Amoney) 1, Length ( Amoney)); Integerue: = Copy (Amoney, 0, POS ('.', Amoney) -1); ResultDecimal: = '.' Direct (decimalvalue); Else Integerue: = amoney;

// Remove the number of larger than Gigabit // Take the integer part of the integer part of the IF length (Integerue)> 16 Then Begin Kilomegavalue: = Copy (Integerue, 0, Length (Integerue) - 12); AccountValue: = Copy (Integerue, Integerue) - 11, Length (Integerue)); Resultkilomega: = Direct (Kilomegavalue) 'Maggate'; ELSE AccountValue: = Integerue;

{Translate integer part of the gigabit}

Some of the IF Length (AccountValue)> 12 The Begin Fourbitstr: = Copy (AccountValue, 0, Length (AccountValue) - 12; Resultaccount: = Resultaccount Fourbit (FourbitStr) FiltrateValue (ACCOUNTVALUE, 1, LENGTH (AccountValue) - 12); End; // Translation between 100 million and $ 100 billions> = 8 Then Begin FourBitstr: = Copy (AccountValue, 0, Length (AccountValue) - 8); ResultAccount: = ResultAccount FourBit (FourBitStr) FiltrateValue (FourBitStr, 'one hundred million'); Delete (AccountValue, 1, Length (AccountValue) - 8); end; / / Translation in parts between 10,000 and $ 10 IF Length> = 5 Then Begin Fourbitstr: = COPY (AccountValue, 0, Length (AccountValue) - 4); Resultaccount: = Resultaccount Fourbit (FourbitStr) FiltrateValue (FourbitStr, '10); delete (AccountValue, 1, Length (AccountValue) - 4); end; // translated part of the following part of Length (AccountValue)> 0 Then Begin Resultaccount: = Resultaccount Fourbit (Copy) AccountValue, 0, Length (AccountValue))); end; // Combined string RE Sult: = Resultkilomega Resultaccount ResultDecimal;

转载请注明原文地址:https://www.9cbs.com/read-26800.html

New Post(0)