std/lingua/en

Standard Library documentation

English text helpers for ZuzuScript.

Module

Name
std/lingua/en
Area
Standard Library
Source
modules/std/lingua/en.zzm

NAME

std/lingua/en - English text helpers for ZuzuScript.

SYNOPSIS

  from std/lingua/en import *;

  say( english_list(["tea", "cake", "jam"]) );
  # tea, cake, and jam

  say( english_number(251) );
  # two hundred and fifty-one

  say( english_ordinal(42) );
  # forty-second

IMPLEMENTATION SUPPORT

This module is supported by all implementations of ZuzuScript.

DESCRIPTION

This module provides pure-Zuzu helpers for presenting English text, using British English conventions (including the serial comma and "and" in hundreds).

EXPORTS

Functions

  • english_list(Collection c, String j := "and")

    Parameters: c is an ordered collection and j is the conjunction before the final item. Returns: String or null. Formats a list of values into English prose.

  • english_number(Number n, Number cutoff?)

    Parameters: n is the number to render and cutoff is an optional numeric rendering limit. Returns: String. Renders a number in English words, falling back to digits when abs(n) exceeds cutoff.

  • english_ordinal(Number n, Number cutoff?)

    Parameters: n is the number to render and cutoff is an optional numeric rendering limit. Returns: String. Renders an ordinal form such as first, second, or third.

COPYRIGHT AND LICENCE

std/lingua/en is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.