In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to transform C # currency format". In daily operation, I believe many people have doubts about how to convert C # currency format. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the question of "how to transform C # currency format"! Next, please follow the editor to study!
C # currency format conversion 1. Format input data to currency format
This example mainly uses the CurrencyGroupSeparator attribute of the NumberFormatInfo class to format the input data into currency format. The CurrencyGroupSeparator property gets or sets the string that groups the digits to the left of the decimal point in the currency value. Run the program, in the input data text box, enter a number, click the "format input data to currency format" button, the effect is shown in figure 5.13.
The main codes for the application of C# currency format are as follows:
Private void button1_Click (object sender, EventArgs e) {NumberFormatInfo nfi = new CultureInfo ("zh-CN", false) .NumberFormat; nfi.CurrencyGroupSeparator = ""; textBox2.Text = Convert.ToDouble (textBox1.Text) .ToString ("c", nfi);}
C # currency format conversion 2. How to convert lowercase amount of goods to uppercase
This example mainly introduces how to convert the amount of goods from lowercase to uppercase. Run the program, enter the lowercase amount in the text box, and click the [OK] button to perform the conversion. The main code is as follows:
Private void button1_Click (object sender, EventArgs e) {String [] Scale = {"fen", "jiao", "yuan", "pick up", "hundred", "thousand", "ten thousand", "pick up", "hundred", "thousand", "hundred", "billion", "pick", "hundred", "thousand", "trillion", "pick up", "hundred", "thousand"} String [] Base = {"zero", "one", "II", "three", "restaurant", "Wu", "Lu", "Qi", "Qing", "nine"}; String Temp = textBox1.Text.ToString (); String Info = null; int index = Temp.IndexOf (".", 0m temp. Length) / / determine whether there is a decimal point if (index! =-1) {Temp = Temp.Remove (Temp.IndexOf ("."), 1); for (int I = Temp.Length; I > 0; Imam -) {int Data = Convert.ToInt16 (temp [temp. Length-I]); Info + = Base [Data-48]; Info + = Scale [I-1];} else {for (int I = Temp.Length; I > 0) Info -) {int Data = Convert.ToInt16 (temp [temp. Length-I]); Info + = Base [temp-48]; Info + = Scale [item1];}} textBox2.Text = Info;} this ends the study of "how to transform the C # currency format", hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.