A good algorithm for converting Arab numbers into Chinese capital (C #) [转]

xiaoxiao2021-03-06  124

// Delicate some of the definition of the class private static string [] cstr = {"zero", "", "", "", "", "Wu", "柒", "捌" "", ""}; Private string [] wstr = {"", "" pick "," "," "," 10,000 "," "," "," 仟 ", "100 million", "pick", "", "仟"}; // number must be in the character string // call mode within 12-bit integers, such as: label1.text = convertint ("Digital String");

Public String Convertint (String Str) ?? {?? int LEN = str.Length; ???? INT i; ?? String Tmpstr, RSTR; ??? rstr = "; ??? for (i = 1; I <= len; i ) ??? {??? tmpstr = str.substring (len-i, 1); ??? rstr = string.concat (cstr [int32.parse (tmpstr)] WSTR [i] , RSTR); ???} ??? rstr = rstr.replace ("pick zero", "pick"); ??? rstr = rstr.replace ("zero pick", "zero"); ????? ?????? rstr = rstr.replace ("zero", "zero"); ??????????? rstr = rstr.Replace ("zero", "zero");? ?? rstr = rstr.replace ("万", "10,000"); ??? for (i = 1; i <= 6; i ) ??? rstr = rstr.replace ("zero zero", "zero "); ??? rstr = rstr.replace," zero "); ??? rstr = rstr.replace (" 零 "," hundreds "); ??? rstr = rstr.replace "Zero zero", "zero"); ??????????????? rrhotic = "round,"; ????????? Return RSTR;??}

Fanz2000's column

Author Blog: http://blog.9cbs.net/fanz2000

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

New Post(0)