Created
June 30, 2011 13:31
-
-
Save mattwarren/1056242 to your computer and use it in GitHub Desktop.
StartsWidth Locale issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RunSnippet() | |
{ | |
var wholeString = "daab"; | |
var prefix = "da"; | |
WL("{0}.StartsWith({1}) = {2}", wholeString, prefix, wholeString.StartsWith(prefix)); | |
WL("{0}.StartsWith({1}, StringComparision.InvariantCulture) = {2}", wholeString, prefix, | |
wholeString.StartsWith(prefix, StringComparison.InvariantCulture)); | |
WL("-------------------------"); | |
WL("Changing locale to \"da\""); | |
WL("-------------------------"); | |
var culture = CultureInfo.CreateSpecificCulture("da"); | |
Thread.CurrentThread.CurrentCulture = culture; | |
Thread.CurrentThread.CurrentUICulture = culture; | |
WL("{0}.StartsWith({1}) = {2}", wholeString, prefix, wholeString.StartsWith(prefix)); | |
WL("{0}.StartsWith({1}, StringComparision.InvariantCulture) = {2}", wholeString, prefix, | |
wholeString.StartsWith(prefix, StringComparison.InvariantCulture)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment