metafunction [scriptblock], - . , ConvertTo-Spanish Invoke-Unwrap : *
function Invoke-Unwrap( [scriptblock]$sb) {
Invoke-Expression ($sb -replace '\r?\n\s*-', ' -')
}
Invoke-Unwrap {
function script:ConvertTo-Spanish( [string]$str ) {
$str
-replace "one","uno"
-replace "two","dos"
-replace "thing","lo"
}
}
ConvertTo-Spanish "thing one and thing two"
Invoke-Unwrap , , "-". , - , , . ($sb -replace '\r?\n\s*([-+*/])', ' $1').
, , , Invoke-Expression, , , , - , SED.
- Apologies for my limited knowledge of Spanish ... :-)
source
share