-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
PSv5 brought the -NoNewline switch to the Set-Content (Add-Content) and Out-File cmdlets to allow direct concatenation of the input objects without newlines (strings among the input objects retain their embedded newlines however).
By default, these cmdlets blindly append an additional newline, whereas Out-String currently invariably does that, because it lacks -NoNewline.
For symmetry, Out-String should support -NoNewline too.
Current behavior
> (Out-String -InputObject 'a') -match '^a\r?\n$'
$True # A trailing newline was added.Desired behavior
> (Out-String -NoNewline -InputObject 'a') -match '^a$'
$True # No trailing newline was added.Environment data
PowerShell Core v6.0.0-alpha (v6.0.0-alpha.18) on Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64Metadata
Metadata
Assignees
Labels
HacktoberfestPotential candidate to participate in HacktoberfestPotential candidate to participate in HacktoberfestIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module