Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Vergleichen Groß und Kleinschreibung

$
0
0

Hallo zusammen,

Wie bekomme ich es hin das in einem Array nach einem Element gesucht wird, aber die Groß und Kleinschreibung beachtet wird?

$array = @("PowerShell", "Java", "PHP")
$element= "java"
if ($array | Where-Object {$_ -eq $element}){
    Write-Host "The array contains the '$element'."
} else {
    Write-Host "The array does not contain the '$element'."
}

Wenn ich das so ausführe, kommt "The array contains the 'java'."
Es sollte aber "The array does not contains the 'java'." rauskommen.

Hat einer ne Idee wie ich das umsetzten kann?

Viele Grüße
gfritz74


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>