Strings Tutorial, Simple Filtering
These questions use the simple text file
http://progzoo.net/greeks.txt - this file includes
around three hundred characters from Greek legends.
You will need to use string methods such as:
length equal substring contains indexOf
Io was a beautiful maiden who had an unfortunate run-in with Zeus and Hera. Io was turned into a heifer plagued by a gadfly.
Print the only two character name.
Odysseus, Perseus and and the other guy all traveled widely and slew monsters.
Identify the three characters where the name ends with "seus".
Cassandra was cursed with the gift of prophecy. She has a nine letter name that ends with "a". Find the others.
Print the names with 9 letter that end in "a".
The Amazons were a fearsome race of warrior women. Their name has an "m" as the second character.
Print the names with "m" as the second character.
Ixion murdered his father-in-law and got on the wrong side of Zeus - two mistakes.
The name Ixion includes an "x", but it does not end in "x" so he is included in our list. The "x" in Ajax is at the end - so he is excluded.
Print the names with an "x", where the name does not end with x.
Several folk have a name ending in "o". We only want them if that is the only "o" in their name.
The sun god Apollo represents order, harmony and civilization; but he does not make our list as he has an "o" before the end of his name.
Print where the first "o" is the last character.