Text Parsing and Formatting

Parse and format the strings frontends handle every day: slugs, query strings, cookies, durations, CSV and version ranges.

  1. 01

    Shorten Text at a Word Boundary

    • easy
    • Code
  2. 02

    Convert Hex Colours to RGB and Back

    • easy
    • Code
  3. 03

    Turn a Title into a URL Slug

    • easy
    • Code
  4. 04

    Join Class Names Conditionally

    • easy
    • Code
  5. 05

    Format File Sizes

    • easy
    • Code
  6. 06

    Format Numbers with Thousands Separators

    • medium
    • Code
  7. 07

    Convert Between Naming Cases

    • medium
    • Code
  8. 08

    Parse and Format Durations

    • medium
    • Code
  9. 09

    Wrap Text to a Line Width

    • medium
    • Code
  10. 10

    Parse and Build Query Strings

    • medium
    • Code
  11. 11

    Render a Mustache-Style Template

    • medium
    • Code
    • Pro
  12. 12

    Format Relative Times

    • medium
    • Code
  13. 13

    Parse and Set Cookies

    • medium
    • Code
  14. 14

    Translate Messages with Plural Forms

    • medium
    • Code
  15. 15

    Match URL Paths to Routes

    • medium
    • Code
  16. 16

    Parse CSV with Quoted Fields

    • hard
    • Code
    • Pro
  17. 17

    Compare Versions and Match Semver Ranges

    • hard
    • Code
    • Pro
  18. 18

    Diff Two Texts Line by Line

    • hard
    • Code
  19. 19

    Write Your Own JSON.stringify

    • hard
    • Code
    • Pro