How to include whitespace in print()

Is there any way to get print() to include whitespace? Specifically, what I'm trying to do is indent output by including leading whitespace, but including internal whitespace would be a nice bonus.

print() strips all leading whitespace.
What I expected was (some variation on) this:
Code:
print("    word");
    word
print("\tword");
    word
What I get is this:
Code:
print("    word");
word
print("\tword");
word

print() also reduces internal whitespace to one space per instance.
What I expected was this:
Code:
print("word1    word2");
word1    word2
print("word1\tword2");
word1    word2
What I get is this:
Code:
print("word1    word2");
word1 word2
print("word1\tword2");
word1 word2

Is there a different function I could be using? I couldn't find anything on the wiki.
 

Veracity

Developer
Staff member
print() does not strip whitespace.

The gCLI uses Java's HTML renderer to display things - and what you describe is how HTML works with whitespace.
 

xKiv

Active member
print() does not strip whitespace.

The gCLI uses Java's HTML renderer to display things - and what you describe is how HTML works with whitespace.

Doesn't it callsRequestLogger.printLine, which calls trim() on the message? So it does strip leading/trailing whitespace - but that's irrelevant because the whitespace wouldn't be displayed anyway.
 
Top