0

Possible Duplicate:
Word wrap a a string in multiple lines

My first guess is that I'll have to do this myself, but I thought I'd ask to make sure there isn't any built in library. I have a string/paragraph that I want to output to a simple text file. However, I want so many spaces (23 to be exact) in the left margin, and I don't want a single line to go past 80 characters. Basically, the code would add the 23 characters to the beginning of each line, and then add new lines after each 80 characters. The hardest part would be to add the new lines since I wouldn't want to add the new line in the middle of a word. Am I on my own here?

Community
  • 1
  • 1
bsh152s
  • 3,178
  • 6
  • 51
  • 77
  • 1
    Use the solution from above with String.PadLeft (http://msdn.microsoft.com/en-us/library/system.string.padleft.aspx) and I think you have your answer. – Ani Jun 12 '12 at 14:13

1 Answers1

0

look at left right padding example here

negEntropy
  • 319
  • 1
  • 5