tags:

views:

641

answers:

3

I want to use a Unicode character such as '\u033F' and build a continuous double-underline string. This would be used to underline totals in a report. Just using "===========" is not acceptable.

How would I do this in C#? Everything I try just leaves me with a single character?

Many thanks.

+5  A: 

There's a constructor on string that will create a string with n copies of a character.

e.g.

new string('\u033F', 10)

will create a string with 10 of your underline character.

Hope this helps

Binary Worrier
+1  A: 

I'm inclined to question why you want to use Unicode to do this, but I suppose you have reasons.

It looks like you'll want to use the U+0333 char (COMBINING DOUBLE LOW LINE). However, I think this is indeed discontinuous. It may be non-ideal, but you could put this char before every char you want underlined.

Also, do note the small set of fonts that actually support this character.

Noldorin
+3  A: 

The character you might be looking for is U+2550, called Box Drawing Double Horizontal, which will display something like ═══════

Console.WriteLine("Hello");
Console.WriteLine(new string('\u2550', 10));
Console.WriteLine("World");
Pierre-Alain Vigeant