Buena
Buena

Reputation: 2491

How to insert a tabSpace into a string?

I'm trying to insert a tabSpace into a string:

string ab = "a" + "\t" + "b"

But I got a square instead of space. Please help.

Upvotes: 3

Views: 9349

Answers (1)

Mark Byers
Mark Byers

Reputation: 838336

Your code is correct.

Note that there is no need to use string concatenation. This achieves the same effect:

string ab = "a\tb";

The problem you have is not with creating the string, but with displaying the string. You are probably using a control that doesn't support displaying tabs. It might be better to replace the tabs with spaces.

Related

Upvotes: 6

Related Questions