diff --git a/Pwsh/Join-String/LogFilepathNotYetExisting.ps1 b/Pwsh/Join-String/LogFilepathNotYetExisting.ps1 new file mode 100644 index 0000000..947be99 --- /dev/null +++ b/Pwsh/Join-String/LogFilepathNotYetExisting.ps1 @@ -0,0 +1,13 @@ + + + +@( + 'temp:\notyetexisting.log' + + Join-path (gi 'temp:') 'notyetexisting.log' + Join-path (Convert-Path 'temp:') 'notyetexisting.log' + + # Can you do this? Yes. Should you? Probably not. + [IO.FIleInfo]::new('temp:\notyetexisting.log') + [IO.FIleInfo]::new( (Join-Path (gi temp:\) 'notyetexisting.log')) + ) | Join-String -f "`n - {0}" diff --git a/Pwsh/Join-String/RandomFormatGenerateSwitch-UsingJoinString.ps1 b/Pwsh/Join-String/RandomFormatGenerateSwitch-UsingJoinString.ps1 new file mode 100644 index 0000000..39ab897 --- /dev/null +++ b/Pwsh/Join-String/RandomFormatGenerateSwitch-UsingJoinString.ps1 @@ -0,0 +1,39 @@ +# using join string instead +$T = @{} +$T.Name = @' + '\s{0}[\s_]' {{ +'@ +$T.Path = @' + Join-Path $FOLDER '{0}' ; break + }} +'@ +$T.Suffix = @' +} +'@ +$T.Prefix = @' +$folder = switch -Regex ($_.Name) { +'@ + +function Join.Prefix { + param( + [int]$Depth = 1 + ) + process { + $Line = $_ + $prefix = ' ' * $depth -join '' + Join-String -f "$Prefix{0}" -in $Line + } +} +@( + $T.Prefix + $records | %{ + $Item = $_ + $T.Name -f $Item.Name + $T.Path -f $Item.Path + } + $T.Suffix +) | + + + +return