VB:Filtering Tutorial

From Progzoo
Revision as of 13:49, 15 November 2008 by Andr3w (talk | contribs) (Small countries (by area).)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 VB: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

You can use Contains for this.

[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]