torsdag 10 maj 2012

String, Tokenizers and encryption

Föreläsning 13.
String:
- ta reda på hur många upperCase letters i en String
- to find a position of a String inside a bigger String and replace that String with another.

Tokenizers:
- delimited by space
- hello there Mary and hello, there (allt understruket är tokens, lägg märke till hello, )

import java.util.*;
String line = readLine();
String Tokenizer tokenizer = new String Tokenizer (line);

Encryption:
- For ex. Caeser Cipher. Rotate alphabet by n letters, n is called the key. Wrap-around at the end.  

OBS Att gå igenom en String en bokstav i taget:
 
   for (int i = 0; i < str.length(); i++) {
      char ch = str.charAt(i);