none
Repeat carriage return RRS feed

  • Question

  • Hi

    I need to repeat a carriage return n number of times. 

    I can do it for a space. For example  string space = new String (' ',10);

    Thanks,

    Ben


    Mr Shaw... One day I might know a thing or two about SQL Server!

    Tuesday, November 27, 2018 5:45 PM

Answers

  • You can do :

    string sStr = string.Concat(Enumerable.Repeat(Environment.NewLine, 10));

    • Marked as answer by Mr Shaw Tuesday, November 27, 2018 6:13 PM
    Tuesday, November 27, 2018 6:04 PM

All replies

  • You can do :

    string sStr = string.Concat(Enumerable.Repeat(Environment.NewLine, 10));

    • Marked as answer by Mr Shaw Tuesday, November 27, 2018 6:13 PM
    Tuesday, November 27, 2018 6:04 PM
  • Did you not even try the obvious answer, "new String( '\r', 10);" ?

    Make sure you actually want the literal "carriage return", or \r, or Control-M, and not a newline, or '\n'.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Tuesday, November 27, 2018 6:08 PM
  • You are right I needed a new line. 

    Castorix31 above has provided the answer I need. 

    Thanks :)


    Mr Shaw... One day I might know a thing or two about SQL Server!

    Tuesday, November 27, 2018 6:14 PM