07-21-2023, 09:00 PM
This problem does not have to be solved this way, but it would save me a lot of precious time if it can be:
I have been logging "line at a time" to a log file. Like this:
$mylogentry = "A string of text containing information"
$mylogentry | out-file -append $log_file_path
$array_of_log_entries += $mylogentry
The reason for the array is that I join them into a Send-Message body.
When I have long quotes however, I like to break them across lines. I can do this using the backtick '`' character.
What I have never worked out is how to escape tabs if the quote line is nested under something else. Using backtick before each indentation doesn't remove the tab.
If you look at sites like this:
This is an attempted example at what I mean. (Note Im having trouble replicating the formatting on SE. 4 space indent doesn't seem to create a code block anymore)
if($somecondition){
$mylogentry = "A string of really long text for non-technical people `
` ` continue to write text here. Additional info (technical): $techvar"
That string would have a big gap between 'people' and 'continue' due to my indenting. I can of course have 'continue' begin at column 0 but then my code looks even more stupid.
I have been logging "line at a time" to a log file. Like this:
$mylogentry = "A string of text containing information"
$mylogentry | out-file -append $log_file_path
$array_of_log_entries += $mylogentry
The reason for the array is that I join them into a Send-Message body.
When I have long quotes however, I like to break them across lines. I can do this using the backtick '`' character.
What I have never worked out is how to escape tabs if the quote line is nested under something else. Using backtick before each indentation doesn't remove the tab.
If you look at sites like this:
[To see links please register here]
you'll see that even while he is encouraging indentation, his code is not indented for the parameters. (You can actually tab those in because whitespace is ignored outside of quotes. Maybe he was just making a point)This is an attempted example at what I mean. (Note Im having trouble replicating the formatting on SE. 4 space indent doesn't seem to create a code block anymore)
if($somecondition){
$mylogentry = "A string of really long text for non-technical people `
` ` continue to write text here. Additional info (technical): $techvar"
That string would have a big gap between 'people' and 'continue' due to my indenting. I can of course have 'continue' begin at column 0 but then my code looks even more stupid.