Skip to content

Commit 0b86a5a

Browse files
committed
Merge branch 'master' into publish-209
2 parents e6b8f0c + 16da1dc commit 0b86a5a

File tree

7 files changed

+276
-295
lines changed
  • samples/snippets
    • cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp
    • csharp/VS_Snippets_CLR_System
    • visualbasic/VS_Snippets_CLR_System
  • xml/System

7 files changed

+276
-295
lines changed

samples/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ int main()
3232
StringComparison::Ordinal,
3333
StringComparison::OrdinalIgnoreCase};
3434

35-
Console::Clear();
3635
Console::WriteLine(introMessage);
3736

3837
// Display the current culture because the culture-specific comparisons

samples/snippets/csharp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cs/ewcmp.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,42 @@ class Sample
99
{
1010
public static void Main()
1111
{
12-
string intro = "Determine whether a string ends with another string, " +
12+
string intro = "Determine whether a string ends with another string, " +
1313
"using\n different values of StringComparison.";
1414

15-
StringComparison[] scValues = {
16-
StringComparison.CurrentCulture,
17-
StringComparison.CurrentCultureIgnoreCase,
18-
StringComparison.InvariantCulture,
19-
StringComparison.InvariantCultureIgnoreCase,
20-
StringComparison.Ordinal,
21-
StringComparison.OrdinalIgnoreCase };
22-
23-
//
24-
Console.Clear();
25-
Console.WriteLine(intro);
26-
27-
// Display the current culture because the culture-specific comparisons
28-
// can produce different results with different cultures.
29-
Console.WriteLine("The current culture is {0}.\n",
30-
Thread.CurrentThread.CurrentCulture.Name);
15+
StringComparison[] scValues = {
16+
StringComparison.CurrentCulture,
17+
StringComparison.CurrentCultureIgnoreCase,
18+
StringComparison.InvariantCulture,
19+
StringComparison.InvariantCultureIgnoreCase,
20+
StringComparison.Ordinal,
21+
StringComparison.OrdinalIgnoreCase };
22+
23+
Console.WriteLine(intro);
3124

32-
// Determine whether three versions of the letter I are equal to each other.
33-
foreach (StringComparison sc in scValues)
25+
// Display the current culture because the culture-specific comparisons
26+
// can produce different results with different cultures.
27+
Console.WriteLine("The current culture is {0}.\n",
28+
Thread.CurrentThread.CurrentCulture.Name);
29+
30+
// Determine whether three versions of the letter I are equal to each other.
31+
foreach (StringComparison sc in scValues)
3432
{
35-
Console.WriteLine("StringComparison.{0}:", sc);
36-
Test("abcXYZ", "XYZ", sc);
37-
Test("abcXYZ", "xyz", sc);
38-
Console.WriteLine();
33+
Console.WriteLine("StringComparison.{0}:", sc);
34+
Test("abcXYZ", "XYZ", sc);
35+
Test("abcXYZ", "xyz", sc);
36+
Console.WriteLine();
3937
}
4038
}
4139

4240
protected static void Test(string x, string y, StringComparison comparison)
4341
{
44-
string resultFmt = "\"{0}\" {1} with \"{2}\".";
45-
string result = "does not end";
46-
//
47-
if (x.EndsWith(y, comparison))
48-
result = "ends";
49-
Console.WriteLine(resultFmt, x, result, y);
42+
string resultFmt = "\"{0}\" {1} with \"{2}\".";
43+
string result = "does not end";
44+
45+
if (x.EndsWith(y, comparison))
46+
result = "ends";
47+
Console.WriteLine(resultFmt, x, result, y);
5048
}
5149
}
5250

@@ -82,4 +80,4 @@ The current culture is en-US.
8280
"abcXYZ" ends with "xyz".
8381
8482
*/
85-
//</snippet1>
83+
//</snippet1>

samples/snippets/csharp/VS_Snippets_CLR_System/system.string.EndsWithCI/cs/ewci.cs

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,54 @@ class Sample
1010
{
1111
public static void Main()
1212
{
13-
string msg1 = "Search for the target string \"{0}\" in the string \"{1}\".\n";
14-
string msg2 = "Using the {0} - \"{1}\" culture:";
15-
string msg3 = " The string to search ends with the target string: {0}";
16-
bool result = false;
17-
CultureInfo ci;
18-
19-
// Define a target string to search for.
20-
// U+00c5 = LATIN CAPITAL LETTER A WITH RING ABOVE
21-
string capitalARing = "\u00c5";
22-
23-
// Define a string to search.
24-
// The result of combining the characters LATIN SMALL LETTER A and COMBINING
25-
// RING ABOVE (U+0061, U+030a) is linguistically equivalent to the character
26-
// LATIN SMALL LETTER A WITH RING ABOVE (U+00e5).
27-
string xyzARing = "xyz" + "\u0061\u030a";
28-
29-
// Clear the screen and display an introduction.
30-
Console.Clear();
31-
32-
// Display the string to search for and the string to search.
33-
Console.WriteLine(msg1, capitalARing, xyzARing);
34-
35-
// Search using English-United States culture.
36-
ci = new CultureInfo("en-US");
37-
Console.WriteLine(msg2, ci.DisplayName, ci.Name);
38-
39-
Console.WriteLine("Case sensitive:");
40-
result = xyzARing.EndsWith(capitalARing, false, ci);
41-
Console.WriteLine(msg3, result);
42-
43-
Console.WriteLine("Case insensitive:");
44-
result = xyzARing.EndsWith(capitalARing, true, ci);
45-
Console.WriteLine(msg3, result);
46-
Console.WriteLine();
47-
48-
// Search using Swedish-Sweden culture.
49-
ci = new CultureInfo("sv-SE");
50-
Console.WriteLine(msg2, ci.DisplayName, ci.Name);
51-
52-
Console.WriteLine("Case sensitive:");
53-
result = xyzARing.EndsWith(capitalARing, false, ci);
54-
Console.WriteLine(msg3, result);
55-
56-
Console.WriteLine("Case insensitive:");
57-
result = xyzARing.EndsWith(capitalARing, true, ci);
58-
Console.WriteLine(msg3, result);
13+
string msg1 = "Search for the target string \"{0}\" in the string \"{1}\".\n";
14+
string msg2 = "Using the {0} - \"{1}\" culture:";
15+
string msg3 = " The string to search ends with the target string: {0}";
16+
bool result = false;
17+
CultureInfo ci;
18+
19+
// Define a target string to search for.
20+
// U+00c5 = LATIN CAPITAL LETTER A WITH RING ABOVE
21+
string capitalARing = "\u00c5";
22+
23+
// Define a string to search.
24+
// The result of combining the characters LATIN SMALL LETTER A and COMBINING
25+
// RING ABOVE (U+0061, U+030a) is linguistically equivalent to the character
26+
// LATIN SMALL LETTER A WITH RING ABOVE (U+00e5).
27+
string xyzARing = "xyz" + "\u0061\u030a";
28+
29+
// Display the string to search for and the string to search.
30+
Console.WriteLine(msg1, capitalARing, xyzARing);
31+
32+
// Search using English-United States culture.
33+
ci = new CultureInfo("en-US");
34+
Console.WriteLine(msg2, ci.DisplayName, ci.Name);
35+
36+
Console.WriteLine("Case sensitive:");
37+
result = xyzARing.EndsWith(capitalARing, false, ci);
38+
Console.WriteLine(msg3, result);
39+
40+
Console.WriteLine("Case insensitive:");
41+
result = xyzARing.EndsWith(capitalARing, true, ci);
42+
Console.WriteLine(msg3, result);
43+
Console.WriteLine();
44+
45+
// Search using Swedish-Sweden culture.
46+
ci = new CultureInfo("sv-SE");
47+
Console.WriteLine(msg2, ci.DisplayName, ci.Name);
48+
49+
Console.WriteLine("Case sensitive:");
50+
result = xyzARing.EndsWith(capitalARing, false, ci);
51+
Console.WriteLine(msg3, result);
52+
53+
Console.WriteLine("Case insensitive:");
54+
result = xyzARing.EndsWith(capitalARing, true, ci);
55+
Console.WriteLine(msg3, result);
5956
}
6057
}
6158

6259
/*
63-
Note: This code example was executed on a console whose user interface
64-
culture is "en-US" (English-United States).
65-
66-
This code example produces the following results:
60+
This code example produces the following results (for en-us culture):
6761
6862
Search for the target string "Å" in the string "xyza°".
6963
@@ -80,4 +74,4 @@ Using the Swedish (Sweden) - "sv-SE" culture:
8074
The string to search ends with the target string: False
8175
8276
*/
83-
//</snippet1>
77+
//</snippet1>

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.EndsWithCmp/vb/ewcmp.vb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Class Sample
1616
StringComparison.InvariantCultureIgnoreCase, _
1717
StringComparison.Ordinal, _
1818
StringComparison.OrdinalIgnoreCase }
19-
'
20-
Console.Clear()
19+
2120
Console.WriteLine(intro)
2221

2322
' Display the current culture because the culture-specific comparisons
@@ -81,4 +80,4 @@ End Class
8180
'"abcXYZ" ends with "XYZ".
8281
'"abcXYZ" ends with "xyz".
8382
'
84-
'</snippet1>
83+
'</snippet1>

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.EndsWithCI/vb/ewci.vb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ Class Sample
2222
' RING ABOVE (U+0061, U+030a) is linguistically equivalent to the character
2323
' LATIN SMALL LETTER A WITH RING ABOVE (U+00e5).
2424
Dim xyzARing As String = "xyz" & "å"
25-
26-
' Clear the screen and display an introduction.
27-
Console.Clear()
28-
25+
2926
' Display the string to search for and the string to search.
3027
Console.WriteLine(msg1, capitalARing, xyzARing)
3128

@@ -57,11 +54,7 @@ Class Sample
5754
End Sub
5855
End Class
5956

60-
'
61-
'Note: This code example was executed on a console whose user interface
62-
'culture is "en-US" (English-United States).
63-
'
64-
'This code example produces the following results:
57+
'This code example produces the following results (for en-us culture):
6558
'
6659
'Search for the target string "Å" in the string "xyza°".
6760
'
@@ -77,4 +70,4 @@ End Class
7770
'Case insensitive:
7871
' The string to search ends with the target string: False
7972
'
80-
'</snippet1>
73+
'</snippet1>

0 commit comments

Comments
 (0)