In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of java how to convert character into string, the content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. I believe you will gain something after reading this java article on how to convert character to string. Let's take a look.
Code:
/ / Standard numeric format string usage instructions and examples class NumberFormat {static void Main () {/ / {index [, alignment] [: format]} / / index-A zero-based integer indicating the element to be formatted in the object list. / / alignment-an optional integer indicating the minimum width, with blanks to fill in the deficiency. A negative number indicates left alignment and a positive number indicates right alignment. / / format-format string. The standard numeric format string takes the form of "Axx" An is a single letter and is described as follows: / / c-currency, xx indicates decimal places / / d-decimal, xx indicates significant places, insufficient zero filling, can only be used for integer / / x-hexadecimal, usage is the same as d / / e-index, xx indicates decimal places / / f-fixed point Xx indicates decimal places / / n-digits, outputs thousand-digit separators, others are the same as f / / g-regular, xx indicates the number of significant digits, using / / p-percentage, the shorter of e or f Xx indicates the number of decimal places / / for example, the output of the following statement is: "| ¥- 5.00 |-05 |-05 |-5.0 |-500% | 12345.7 | 12345.7 |" System.Console.WriteLine ("| {00:d2} c} | {0:d2} | {0magentin 50:d2} | {0:p0} | {1:f1} | {1:n1} |",-5, 12345.67)) }}
12345.ToString ("n"); / / generate 12345.00
12345.ToString ("C"); / / generate ¥12345.00
12345.ToString ("e"); / / generate 1.234500e+004
12345.ToString ("f4"); / / generate 12345.0000
12345.ToString ("x"); / / generate 3039 (hexadecimal)
12345.ToString ("p"); / / generate 1234500.00%
Percentage conversion to numerical type
Convert.ToDouble (s.TrimEnd ('%')) / 100
This is the end of the article on "how java converts characters to strings". Thank you for reading! I believe you all have a certain understanding of "how to convert characters into strings in java". If you want to learn more, you are welcome to follow the industry information channel.
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.