Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - String handling: ordinal or invariant or current-culture?

Reply
 
Old 10-22-2006   #1 (permalink)
Andrew Webb


 
 

String handling: ordinal or invariant or current-culture?

Given this C#:-

String filePathname1 = ...
String filePathname2 = ...
if (String.Equals (filePathname1, filePathname2,
StringComparison.OrdinalIgnoreCase))

what would the equivalent PowerShell script be?

E.g. would it be:-
if ($filePathname1 -ieq $filePathname2)

I.e.
- do -eq and -ieq perform ordinal string comparisons?
- if not, then what?
- is the behaviour defined, and fixed for all time?
- if the behaviour is ordinal and I want a cultural comparison, do I have
to kick-up to .NET?
- how about the -lt and -gt operators?
- is the bevahiour documented anywhere?

Also, are there interesting and important things to note re. PowerShell's
value-to-string and string-to-value conversions (current culture vs.
specified culture vs. invariant culture)?

I think it would be great to have this sort of thing nailed down. It would
help me to be able to script in confidence.

Many thanks.

Andrew

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista Ultimate SP1 - popup.exe - Ordinal Not Found Vista General
Could not find any resources appropriate for the specified culture or the neutral culture .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46