4

I would like to put a string of spaces in code in an SO answer:

ddl1.Items.Add("12         34")

Without code, I can use  . In code, I cannot:

ddl1.Items.Add("12         34")

And, in code, these six spaces collapse into one:

ddl1.Items.Add("12 34")

Is there a way to show a string of spaces in code mode?

3
  • In code, these six spaces collapse into one. In my experience, they don't. Are you positive you're using code blocks (four leading spaces) and not another type of formatting? Commented Jan 25, 2013 at 8:00
  • That's the solution! It collapses when you use backward quotes for the code, but not in an indented code block. Is that intentional?
    – xpda
    Commented Jan 25, 2013 at 8:02
  • I believe so. Backticks are used for inline code spans (function or variable names in a sentence, for instance), preserving whitespace is not their primary goal. Commented Jan 25, 2013 at 8:05

1 Answer 1

2

You can do it using four space markdown like this:

ddl1.Items.Add("12      34")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .