Powershell help

Status
Not open for further replies.

Banku

Seniorius Lurkius
2
Hello all,

I hoping somone can help me come up with a powershell script that can assigne scores (or numbers) to the letters in name, take the average and multiple the result by 1000. For example looking at names below, for the word "air", I want to be able to use powershell to do the following calculation using the values from the sample alphabet table.

(0.106+0.0758 + 0.071)/3 *1000

The names in the array are:
noise
call
air

Alphabet and Weight
Character Score
E 0.106
A 0.0877
I 0.0758
O 0.0736
R 0.071
N 0.066
S 0.016
L 0.045
C 0.154

Thank you
 

Utildayael

Ars Tribunus Angusticlavius
7,345
You could convert the strings into arrays and run through each array item to assign values or work the math.

You'd use something like this to convert:

$someString.ToCharArray()


From there you could do a Foreach to iterate the array items and "do stuff" with them which in this case would be to probably start a count at 0 and increment for the value of each letter and then divide that by number of array items and multiply by 1000.

Probably cleaner ways to do it but that should work. :)
 
Status
Not open for further replies.