C # code: / * .NET / C # / T-SQL / VB / Java implementation: Convert Astronomical digital to Chinese capital Recently, this big write amount is converted. I have seen a few, I feel that I think it is better to write with VB6 in 2000. : "VB6 data formatted object usage skills" http://search.9cbs.net/expert/topic/38/38970.xml?temp =.5078089 << Essence: Code to lower handwriting to uppercase 100 million >> http://www.dev-club.com/club/bbs/showssence.asp?id=20684&page=1 ideas is very simple, and there is no bit limit! For example: 401, 0103, 1013 Read as:零 零 壹 [] 佰 叁 叁 [万] 壹 零 零 壹 叁 叁 每 每 每 从]]]]]]]]]]]]]]]]]]]]]] The unit is: "[hundred million]" "零 零 叁" unit is: "[Wan]" "零 叁" unit is "" "" (equivalent to no unit) is easy to find, every four digits: only thousand Bit, 100, ten, one of these four sites! We put [Wan], [100 million] as a unit! This is the law! Simple! According to the idea, only the area is less than 50 lines The code can get the code: as long as you can provide enough "unit" any astronomical figures can be converted correctly! * / Namespace microshaoft {using system; public class util {public static string converTnumBertoChinese (String X, String [] Nums, String [ ] Digits, String [] Units {string s = ""; // Return value int P = 0; // Character position pointer int m = x.length% 4; // Take the mold // four sets of groups Number INT K = (m> 0? X.length / 4 1: x.length / 4); // Outer loop cycle in all groups // from left to right to the low four sets of group-by-group理 // The last group is finally coupled with a unit: "[trillion]", "[billion]", "[10,000]" for (int i = k; i> 0; I -) {int L = 4; IF (i == K && M! = 0) {l = m;} // Get a set of four-digit highest bit groups may be less than four string s = x.substring (p, l); int L = S .Length; // The inner layer cycle is circulated from left to right to low for each of the left to the right to low for (int J = 0; j () INT N = Convert.Toint32 (S.Substring (j, 1)); if (n == 0) {IF (j //Bit array string [] Digits = new string [] {"", "pick", "", "}"}; // unit array String [] units = new string [] {"", "[10 ] "," [Billion] "," [trillion] "}; console.writeline (ConvertNumbertochinese); console.writeline (ConvertNumbertochinese (" 2100000000 ", NUMS, DIGITS, Units )); Console.WriteLine (ConvertNumberToChinese ( "1000000000", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "40000000013", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "40000000001", Nums , Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "400000010000", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "40101031013", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( " 40101031113 ", NUMS, DIGITS, UNITS); Convele.Writeline (ConvertNumbertochinese (" 101140101031013 ", NUMS, DIGITS, UNITS); Conso le.WriteLine (ConvertNumberToChinese ( "100000001000013", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "100000001000113", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "100011003", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "10010103", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "10110013", Nums, Digits, Units)); Console.WriteLine (ConvertNumberToChinese ( "130000", NUMS, DIGITS, UNITS); Console.readline ();}}} T-SQL UDF Code: Create Function ConvertNumBertochinese (@ varchar (100)) Returns varchar (100) as begin - Declare @ varchar (100) --set @ = '10114010103013' declare @s varchar (100) set @s = '' Declare @P integer set @P = 0 declare @m integer set @m = len (@)% 4 declare @K integer set @K = len (@) / 4 select @K = @K 1 where @m > 0 Declare @i integer set @i = @K while (@i> 0) begin --outer declare @L integer set @L = 4 select @L = @m! = 0 Declare @ss = substring (@, @ p 1, @ L) Declare @LL integer set @LL = LEN (@ss) - Inner declare @j integer set @J = 0 while @J <@LL) - Inner Begin - Inner Declare @n integer set @n = cast (@ SS, @ J 1, 1) as integer @num varchar (2) SELECT @num = Num From (SELECT 0 AS ID, 'Zero' As Num Union All Select 1, '壹' Union All Select 2, '' Union All SELECT 3, '' Uni On All Select 4, '' Union All Select 5, 'Wu' Union All Select 6, 'Lu' Union All Select 7, '柒' Union All SELECT 8, '捌' Union All SELECT 9, '捌') NUMS Where id = @n if @n = 0 begin select @S = @S @num where @J <@ LL - 1 and cast (@ss, (@SS, (@ J 1) 1, 1) AS integer> 0 and right (@ ss, 1)! = @num end else begin declare @JJ integer set @jj = 1 SELECT @JJ = @J - 1 where @J> 1 SELECT @S = @S @num where not (@n = 1 and @J = @LL - 2 and (len (@S) = 0 or Right ( @ s, 1) = 'zero' / * (Select Num from (SELECT 0 AS ID, 'zero' As Num Union All Select 1, '壹' union all SELECT 2, '' union all SELECT 3, '' Union All SELECT 4, '' Union All Select 5, 'Wu' Union All Select 6, 'Lu' Union All Select 7, '柒' Union All SELECT 8, '捌' Union All SELECT 9, '捌') NUMS WHERE ID = 0) * /)) SELECT @S = @S Digit from (SELECT 0 AS ID, '' AS Digit Union All SELECT 1, 'Picking' Union All Select 2, '佰' Union All SELECT 3, '仟') Digits where id = @ll - @J - 1 end set @J = @J 1 - Inner End - @l declare @Unit varchar (10) select @unit = unit from "SELECT @unit = Unit from SELECT 0 AS ID, 'AS Union All Select 1,' [Wan] 'Union All Slect 2,' [100 million] Union All SELECT 3, '[Trills]') Units Where ID = @i - 1 IF @ @ @K begin select @S = @S @Unit WHERE CAST (@ss as integer)! = 0 end else begin set @S = @S @Unit end set @i = @i - 1 - @S End --out return @S / * --te: select dbo.convertnumbertochinese ('101111112101013'), dbo.convertnum berToChinese ( '40000000001'), dbo.ConvertNumberToChinese ( '400000010000'), dbo.ConvertNumberToChinese ( '40101031013'), dbo.ConvertNumberToChinese ( '101140101031013'), dbo.ConvertNumberToChinese ( '100000001000003'), dbo.ConvertNumberToChinese ( '10011003' ), dbo.convertnumbertochinese ('10010103'), DBO.CONVERTNUMBERTOCHINESE ('10010013') * / end VB6 Code: "VB6 data formatted object usage skills" http://search.9cbs.net/expert/topic/38/38970.xml?temp =.5078089 << Essence: Code of the amount of lowercase switch to uppercase To 100 million >> http://www.dev-club.com/club/bbs/showssence.asp?id=20684&page=1vb.net code: After you can compile C # Code into EXE, Reflector is referring to the VB. NET / DELPHI.NET / IL and other language source code Java Code: Public Class Class1 {Public Static String ConvertNumBertochinese (String X, String [] NUMS, STRING [] Digits, String [] Units {string s = ""; // Return Value INT P = 0; // Character position Pointer int m = x.length ()% 4; // Take the mold // four sets of gathered group INT K = (m> 0? X.length () / 4 1: x.length () / 4 ); // The outer cycle cycle in all groups // from left to right to the lower four groups of group-by-group processing //, each group finally plus a unit: "[trillion]", "[billion]" "[万]" for (int i = k; i> 0; I -) {INT L = 4; if (i == k && m! = 0) {l = m;} // Get a group The four-digit highest bit group is likely to be less than four string s = x.substring (p, p l); intl = s.Length (); // In the inner layer cycle in each of the groups From left to right to low for (int J = 0; J NUMS [N];} S = DIGITS [L - J - 1];}} P = L; // Each group finally plus a unit: [10,000] and other IF (i