Home > Net >  String format alignment problem
String format alignment problem

Time:10-06

String s1="123456 t";
Want to s1 left-aligned, length of 100
String s2=s1. The format (" {0100} ", s1);
To solve the problem

If the 100 is a variable control, how to write? In c + + is used for *, don't know how to write in c #? Thank you

CodePudding user response:

Your adjustment is calculated according to the length of the 100 and s1 {0100}

CodePudding user response:

The default fill to a 100 - bit?
 
S1=s1. PadLeft (100, ");

CodePudding user response:


A tornado blowing destroyed the parking lot of the methods to solve my problem,
  •  Tags:  
  • C#
  • Related