String Class Hands On

1. Write code to enter two strings and then tell if the second is contained in the first.

2. Write code to enter two strings and then tell how many times the second is contained in the first.

3. Write code to replace 'o's in a string with zeros (0). Kenyon College -> Keny0n C0llege.

4. Write code to check if a string is a palindrome, ignoring punctuation and spaces:

  • A man, a plan, a canal--Panama!
  • Able was I ere I saw Elba.
  • Too bad--I hid a boot.
  • Do geese see God?
  • Murder for a jar of red rum.
  • Drab as a fool, aloof as a bard.
  • Go deliver a dare, vile dog!
5.
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2019-11-05 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback