0
body:"""
Hi, how are you? Yes, I am doing good. what about you. How are things going?
Nothing interesting, as usual.
"""

In the above lines, I want to print a sentence in new line in groovy (body), how can I accomplish that? Note: I am new to groovy

I tried using b tag and nothing worked.

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Yamuna S
  • 13
  • 4

1 Answers1

0

You have done it correctly...

body:"""Hi, how are you?
Yes, I am doing good.
what about you.
How are things going?
Nothing interesting, as usual."""

You can also ask the system for the correct line separator, since it can change on different operating systems.

writer << "Line 1" + System.getProperty("line.separator") + "Line 2"
Timothy Alexis Vass
  • 2,526
  • 2
  • 11
  • 30
  • I tried something and it worked, now I am trying to include HTML tags. My requirement is to add something like, thanks and regards (in one line), in next line a image, followed by name (in new line), kindly let me know how I can achieve this – Yamuna S Feb 03 '23 at 09:04
  • First you need to select this answer as correct and you can upvote it if you want to. Then you need to create a new question for the next issue you have. – Timothy Alexis Vass Feb 03 '23 at 09:26