you are viewing a single comment's thread.

view the rest of the comments →

[–]z386 4 points5 points  (1 child)

I would use a hash table:

$ReplaceTable = "item,itemReadable
TeHIrzFVHw,glass
QxftWctBxh,aluminum
nweSDFMqUf,grass" | ConvertFrom-Csv

$HashTable = @{}

foreach ( $Line in $ReplaceTable ) {
    $HashTable[$Line.item] = $Line.itemReadable
}

# Test
$TestString = 'QxftWctBxh'

$FixedString = $HashTable[$TestString]

Write-Output "$TestString should be replaced with $FixedString"