Rules: no spoilers.

The other rules are made up as we go along.

Share code by link to a forge, home page, pastebin (Eric Wastl has one here) or code section in a comment.

  • swlabr@awful.systems
    link
    fedilink
    English
    arrow-up
    4
    ·
    11 months ago
    1 a,b:

    as a professional software engineer, I know that googling regex syntax and getting it right will take longer than manually writing string comparisons, so… here’s all you need to see of my final solution.

      int? check3(String line, int index) {
        if (line.length < index + 3) {
          return null;
        }
    
        String sub = line.substring(index, index + 3);
        return sub == "one"
            ? 1
            : sub == "two"
                ? 2
                : sub == "six"
                    ? 6
                    : null;
      }