Skip to content

Commit 1c22c59

Browse files
author
Conner.Will
committed
Added removal of empty lines from beginning and end
1 parent 4de74af commit 1c22c59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Convert-ImageToASCIIArt.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ function Convert-ImageToASCIIArt {
129129

130130
$asciiChars = $asciiChars -replace "[{0}-{1}]" -f $minCharIndex, $maxCharIndex, $contrastChars
131131

132+
# Remove blank lines from the start of the text
133+
$asciiChars = $asciiChars -replace "(?m)^\s*`r?`n", ""
134+
135+
# Remove blank lines from the end of the text
136+
$asciiChars = $asciiChars -replace "`r?`n\s*$", ""
137+
132138
# Output the ASCII art.
133139
Write-Verbose -Message "Outputting the ASCII art"
134140
Write-Output $asciiChars

0 commit comments

Comments
 (0)