Skip to content

Commit

Permalink
StringBuilder examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SamErde committed Feb 17, 2024
1 parent b6d38bd commit 5922d42
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Snippets/StringBuilder Examples.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$sb = [System.Text.StringBuilder]::New()
$sb.Append('a').AppendFormat('{0} {1}', 'c', 'd').AppendLine()

$items = Get-ChildItem -Recurse | Where-Object { $_.Name -match '^*.ps1$' }

foreach ($script in $items) {
$null = $sb.Append((Get-Content -Path $script.FullName -Raw))
$null = $sb.AppendLine('')
}

$sb.ToString() | Out-File -FilePath $FilePath -Encoding utf8 -Force

0 comments on commit 5922d42

Please sign in to comment.