Using the code below, the spacer does not seem to play as it should, theoretically the text "ADD this text" should start with column 21 on both lines, but in str2 it has a few extra spaces. When checking the length of both lines, the length was 20, as expected.
string str1 = "Test".PadRight(20);
string str2 = "Test123".PadRight(20);
string common = "Add this text";
MessageBox.Show(str1.Length.ToString());
MessageBox.Show(str2.Length.ToString());
MessageBox.Show(str1 + common + "\n" + str2 + common);
Has anyone encountered this problem before? Is there something obvious I'm missing.
Many thanks.
source
share