Difference between revisions of "C#:Filtering Tutorial"

From Progzoo
Jump to: navigation, search
(Picking the stans.)
Line 50: Line 50:
 
</p>
 
</p>
 
<hint>Look at  
 
<hint>Look at  
[http://progzoo.net/ht25Tests/15StringEnds.xml
+
[C#:Simple_Tests Checking the end of a string.]
Checking the end of a string.]
+
 
</hint>
 
</hint>
 
</question>
 
</question>
 +
 
==Countries with a z.==
 
==Countries with a z.==
 
<question lang="cs" className="Cia" copyFile="bbc.txt"><prog><![CDATA[
 
<question lang="cs" className="Cia" copyFile="bbc.txt"><prog><![CDATA[

Revision as of 19:57, 13 March 2013

In these examples we select only some countries to print. A process that takes a list and selects only certain items is a "filter". Some get through, some don't.

You may need to review C#:Testing strings and numbers before you attempt these questions.

Selecting a region.

Print the countries where the region is Europe.

[Font] [Default] [Show] [Resize] [History] [Profile]

Picking the stans.

Print only those countries where the name ends with stan

[Font] [Default] [Show] [Resize] [History] [Profile]

Countries with a z.

Print only those countries where the name contains the letter z

[Font] [Default] [Show] [Resize] [History] [Profile]

Small countries (by area).

Print the countries that have an area of less than 100.

[Font] [Default] [Show] [Resize] [History] [Profile]