Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Latest commit

 

History

History
92 lines (65 loc) · 3.73 KB

string.md

File metadata and controls

92 lines (65 loc) · 3.73 KB

String

The Concept

A string is a sequence of characters (letters, digits, punctuation, etc.).

What to cover

Tell a student what a string is in your language, how strings can be manipulated, and ensure they understand where to look for docs on strings.

  • Explain what strings are in your language? Is it a sequence of bytes, UTF-8 characters or something else? Are strings objects or primitives?
  • How are strings brought together? Do you join strings, add strings, concatenate strings, interpolate strings? It's worth giving a hint as to which is normal, or letting the student know all are ok!
  • How are strings split apart? How do I extract a bit of a string?
  • Where do helper methods for strings live? If I want to trim a string, or check it's length, how do I do that in your language? Are these string methods or functions that act on strings?

Exercises

High School Sweethearts

This exercise customizes an ASCII heart with initials of given two full names. The reference implementation (Elixir) teaches:

  • String concatenation
  • String interpolation
  • Trimming
  • Changing casing (uppercase)
  • Extracting substrings (first letter)
  • Multiline strings

Implementations

Track Exercise Changes
Elixir strings None

Log Lines

This exercise extracts information from log lines. The reference implementation (C#) teaches:

  • String concatenation
  • Trimming
  • Changing casing
  • Extracting substrings

Implementations

Track Exercise Changes
C++ strings None
C# log-levels None
F# strings None
Ruby strings None
Python strings None
Go strings-package None

Poetry Club

This exercise is a conversation between you and the security guard. The reference implementation (JavaScript) teaches:

  • String substrings (first, last letter)
  • String casing (Word capitalization, normalisation).
  • String reversing
  • String concatenation

Implementations

Track Exercise Changes
JavaScript strings None

Party Robot

This exercise implements some phrases an eccentric party robot would say.

  • String introduction
  • String formatting

Implementations

Track Exercise Changes
Go strings None