Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.23 KB

File metadata and controls

46 lines (35 loc) · 1.23 KB

Week 1

  • Flesch Readability Score is a measure of text readabilty

    • Formula: 206.835 - 1.015 * (# words / # sentences) - 84.6 * (# syllables / # words)
  • Interned strings allow Java to treat 2 duplicate strings as the same object in memory.

    String text = new String("Text shiz");  # New object
    String text2 = "Hello world!";  # Refers to the same "interned" object.
    String text3 = "Hello world";  # Refers to the same "interned" object.
    
  • Only use == to check equality of objects. Use str1.equals(str2) to compare values (eg in strings).

  • String methods in Java:

    • length
    • toCharArray
    • charAt - return character at string position
    • split
    • indexOf
  • For each loop in Java:

for (char c : word.toCharArray())
{
    if (c == letter)
    {
        return true;
    }
}
  • Regular Expressions:

    • a - match a.
    • a+ - match one or more as.
    • a* - match zero or more as.
    • (ab)+ - match one or more abs.
    • [abc] - match any character inside the set.
    • [a-c] - match any character between a and c.
    • [^a-c] - match anything that's not between a and c.
    • a|c - match a or c.