lib/Str/PfxSfx.ps1
function Is-Pfx ($s,$pfx) { ([string]$s).StartsWith($pfx,[StringComparison]::InvariantCultureIgnoreCase) } function Is-Sfx ($s,$sfx) { ([string]$s).EndsWith($sfx,[StringComparison]::InvariantCultureIgnoreCase) } function Rmv-PfxSfx($s,$pfx,$sfx){ Rmv-Sfx (Rmv-Pfx $s $pfx) $sfx } function Rmv-Pfx ($s,$pfx) { if(Is-Pfx $s $pfx){Mid $s ((Len $pfx)+1)}else{$s}} function Rmv-Sfx ($s,$sfx) { if(Is-Sfx $s $sfx){$a=Len $s; $b=Len $sfx; $n=$a-$b; Left $s $n}else{$s}} |