Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the representation and answer of C # spaces

Shulou Source: shulou.com Published: 2022-06-02 11:44:26 10月03日 Update

Today, I will talk to you about how to achieve C#space expression and answer, many people may not know much, in order to let everyone know more, Xiaobian summarized the following content for everyone, I hope you can harvest according to this article.

Implement C#space to represent the question

I want to add one or several spaces to a string. What should I do? How should I write space?

Implement C#space to indicate answer 1

Console.WriteLine( "|| "+ " "+ "space "+ " "+|| ");

Implement C#space to indicate answer 2

string str = "Hello " str.PadLeft(10, ' ');

PadRight

5 spaces are added, excluding the 5 lengths occupied by Hello.

C#is the answer.

You can add spaces directly "" or you can write your own method of adding spaces. If it is to fill spaces around, you can directly use

PadLeft PadRight

After reading the above, do you have any further understanding of how to implement C#space representation and answer? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.

Tags: Spaces clips content characters strings methods more knowledge articles industry information information channels length channels enter one support related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB Linux Shulou Information Shulou Tech Info