How to make up the quantile with C # space function
This article mainly introduces "how to fill the quantile with the C # space function". In the daily operation, I believe that many people have doubts about how to use the C # space function to fill the quantile. The editor consulted all kinds of data and sorted out a simple and useful method of operation. I hope it will be helpful to answer the doubt of "how to fill the quantile with the C # space function". Next, please follow the editor to study!
Sometimes, in order to unify the format, when the number of digits is insufficient, the C # space function is used to make up. For example: 13:42:05, 2008-01-01, in which the month, day and second are filled.
Strings can be easily padded in C # using the C # space functions PadLeft and PadRight.
PadLeft (int totalWidth, char paddingChar) / / complement the totalWidth length with paddingChar on the left side of the string PadLeft (int totalWidth, char paddingChar) / / complement the totalWidth length with paddingChar on the right side of the string
Example of a C # space function:
H = h.PadLeft (2,'0')
Note that the second argument is of type char, so using single quotation marks, you can also use Convert.ToChar (string value) to convert the string to type char. If the string length is greater than 1, use str.ToCharArray () [index].
At this point, the study on "how to use the C # space function to fill the quantile" is over. I hope to be able to solve your 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!