Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed Dec 25, 2023
1 parent 3f5a933 commit d642898
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Pwsh/Join-String/LogFilepathNotYetExisting.ps1
Original file line number Diff line number Diff line change
@@ -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}"
39 changes: 39 additions & 0 deletions Pwsh/Join-String/RandomFormatGenerateSwitch-UsingJoinString.ps1
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d642898

Please sign in to comment.