SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Aug 2000
    Location
    oakland,ca,u.s.a
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Print( \"\\n\" ) is there a newline character?

    this must be really simple or just not possible...but I cannot figure out what is the escape character or whatever special symbol to use to print( )a newline to the results file, like in C where you use backslash n( \n ) to cause a carriage return.

    Dave
    QA Engineer
    CareBid.com

  2. #2
    Member
    Join Date
    Aug 2000
    Location
    oakland,ca,u.s.a
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Print( \"\\n\" ) is there a newline character?

    I know alot of you are thinking..."why not just do this:

    print()

    right? well, I want to do this:

    print("This is a long string \n and it wraps to the next line after \n the backslash n")

    //OUTPUT LIKE THIS:
    //This is a long string
    //and it wraps to the next line after
    //the backslash n
    Dave
    QA Engineer
    CareBid.com

  3. #3
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Print( \"\\n\" ) is there a newline character?

    If you would like to do that here's teh way:
    Make sure you don't place a space between the < and the Enter (I cannot seem to diplay it otherwise... It's thinking I'm typing an HTML Tag.
    ------------------
    AJ Alhait
    BetaSoft Inc.



    [This message has been edited by AJ (edited 09-01-2000).]
    AJ Alhait
    BetaSoft Inc.

  4. #4
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Print( \"\\n\" ) is there a newline character?

    The last reply from AJ said:

    "Make sure you don't place a space between the < and the Enter (I cannot seem to diplay it otherwise... It's thinking I'm typing an HTML Tag".

    But the example showed "< Enter>", so did you really mean to say "Make sure you DO place..."?

    At any rate another method, which can be used to embed any character in a Print string is:

    Print ("first{Chr(10)}second{Chr(10)}third")

    Which then prints "first", "second", and "third" each on a new line.

    I use this often enough that I have created a const defined as:

    const CRLF = Chr(10)

    Then the above code would be written as:

    Print ("line 1{CRLF}line2{CRLF}line 3")



  5. #5
    Senior Member
    Join Date
    Jul 2000
    Location
    Walsall, West Midlands, United Kingdom
    Posts
    259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Print( \"\\n\" ) is there a newline character?

    Like 'C' - try using 'printf' instead of 'print'.... works for me ok.

  6. #6
    AJ
    AJ is offline
    Moderator AJ's Avatar
    Join Date
    Jun 1999
    Location
    San Jose, CA
    Posts
    1,691
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Print( \"\\n\" ) is there a newline character?

    Terry,

    I meant not to add a space between the < and the E in < Enter> it's like using < Tab> or < BackSpace> etc... The thing is on the forums if you have a < and then any letter and > it thinks it's an HTML tag and it gets hidden.

    ------------------
    AJ Alhait
    BetaSoft Inc.
    AJ Alhait
    BetaSoft Inc.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:29 PM.

Copyright BetaSoft Inc.