Hey guys I am having trouble figuring out how to convert the following function (which requires an input) into a variable
function Convert-ToLetters ([parameter(Mandatory=$true,ValueFromPipeline=$true)][int] $value) {
$currVal = $value;
$returnVal = '';
while ($currVal -ge 26) {
$returnVal = [char](($currVal) % 26 + 65) + $returnVal;
$currVal = [int][math]::Floor($currVal / 26)
}
$returnVal = [char](($currVal) + 64) + $returnVal;
return $returnVal
}
What this Function does is to convert a number into letters.
Now what I want to achieve is to somehow do this:
$convert2letter = Convert-ToLetters()
So that I can do something like
$WR= "$convert2letter($CValue1)" + "-" + "$convert2letter($CValue2)" + "-" + "3"
But Powershell isnt allowing me to do $convert2letter
So what can I do here?
Thanks