Skip to content

[P2] String helpers: capitalize, pad-left/pad-right, repeat #23

Description

@ecto

The Loon string builtins cover the basics (uppercase, lowercase,
trim, split, join, replace, starts-with?, ends-with?,
contains?, index-of, substring, char-at, len), but a few
common operations are missing:

  • capitalize — uppercase first character, lowercase the rest
  • pad-left / pad-right — pad a string to a target width
  • repeat — repeat a string N times (e.g. [repeat "-" 10])

The modules guide shows capitalize as an example user function,
suggesting demand.

Acceptance criteria

  • Builtins available in the VM and documented in ref/builtins.loon.
  • Tests for empty strings, unicode strings, and width-shorter-than-input
    for the pad functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions