Skip to content

Commit

Permalink
Various minor doc improvements
Browse files Browse the repository at this point in the history
* Move note below Contents
* Remove horizontal lines (they were practically invisible anyway)
* Remove trailing whitespace
* Remove note about Unicode; it's not really relevant here.
* Explain what "ic" stands for.
* Revamp the Other Useful Functions a bit
  • Loading branch information
cgay committed May 18, 2022
1 parent 69cb20f commit b76d11c
Showing 1 changed file with 28 additions and 52 deletions.
80 changes: 28 additions & 52 deletions documentation/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@ The strings Library
.. current-library:: strings
.. current-module:: strings

The strings library exports definitions for basic string manipulation.
The *strings* library exports definitions for basic string manipulation.

The *strings* library was originally defined in `DEP-0004
<http://opendylan.org/proposals/dep-0004.html>`_. Some additional background
material can be found there.

.. contents:: Contents
:local:

.. note::

* This library does not address any higher-level operations such as
text formatting or anything that requires semantic knowledge of
words, such as *pluralize*.
* This library does not address any higher-level operations such as text
formatting or anything that requires semantic knowledge of words, such as
pluralization or internationalization.

* Where it makes sense, functions can be applied to either a single
character or a string of characters. For example, ``lowercase('C')
=> 'c'`` and ``lowercase("Foo") => "foo"``.

* Functions are case-sensitive by default. Versions that ignore
alphabetic case are named with a trailing "-ic" or "-ic?".

* Open Dylan doesn't yet support Unicode. When it does, this library
will be updated to support it also.

The strings library was originally defined in `DEP-0004
<http://opendylan.org/proposals/dep-0004.html>`_. Some additional
background material can be found there.


.. contents:: Contents
:local:
* Functions are case-sensitive by default. Versions that ignore alphabetic
case are named with a trailing "-ic" or "-ic?", which means "ignore case".


The strings Module
Expand Down Expand Up @@ -63,7 +59,7 @@ Character Class Predicates
alphabetic?('a') => #t
alphabetic?('-') => #f
.. method:: alphabetic?
:specializer: <string>
:sealed:
Expand All @@ -85,8 +81,6 @@ Character Class Predicates
alphabetic?("abc") => #t
alphabetic?("abc123") => #f
alphabetic?("abc123", end: 3) => #t
------------
.. generic-function:: alphanumeric?
:sealed:
Expand Down Expand Up @@ -133,8 +127,6 @@ Character Class Predicates
alphanumeric?("abc...") => #f
alphanumeric?("abc...", end: 3) => #t
------------

.. generic-function:: control?
:sealed:

Expand Down Expand Up @@ -184,8 +176,6 @@ Character Class Predicates
control?("abc\0") => #f
control?("abc\0", start: 3) => #t
------------

.. generic-function:: graphic?
:sealed:

Expand Down Expand Up @@ -237,8 +227,6 @@ Character Class Predicates
graphic?("ABC\n") => #f
graphic?("ABC\n", end: 3) => #t
------------

.. generic-function:: printable?
:sealed:

Expand Down Expand Up @@ -291,8 +279,6 @@ Character Class Predicates
printable?("abc\0") => #f
printable?("abc\0", end: 3) => #t
------------

.. generic-function:: whitespace?
:sealed:

Expand Down Expand Up @@ -344,8 +330,6 @@ Character Class Predicates
whitespace?("x\t x") => #f
whitespace?("x\t x", start: 1, end: 3) => #t
------------

.. generic-function:: decimal-digit?
:sealed:

Expand Down Expand Up @@ -394,8 +378,6 @@ Character Class Predicates
decimal-digit?("x123y") => #f
decimal-digit?("x123y", start: 1, end: 4) => #t
------------

.. generic-function:: hexadecimal-digit?
:sealed:

Expand Down Expand Up @@ -446,8 +428,6 @@ Character Class Predicates
hexdecimal-digit?(" ff00 ") => #f
hexdecimal-digit?(" ff00 ", start: 1, end: 5) => #t
------------

.. generic-function:: octal-digit?
:sealed:

Expand Down Expand Up @@ -631,8 +611,6 @@ Case Conversion Functions
lowercase("Hack Dylan!") => "hack dylan!"
lowercase("Hack Dylan!", end: 4) => "hack"
-------------

.. generic-function:: lowercase!
:sealed:

Expand Down Expand Up @@ -685,8 +663,6 @@ Case Conversion Functions
lowercase!("Hack Dylan!")
=> error, attempt to modify a string constant
-------------

.. generic-function:: lowercase?
:sealed:

Expand Down Expand Up @@ -737,8 +713,6 @@ Case Conversion Functions
lowercase?("Why me?", start: 1) => #t
lowercase?("e.e. cummings") => #t
-------------

.. generic-function:: uppercase
:sealed:

Expand Down Expand Up @@ -787,8 +761,6 @@ Case Conversion Functions
uppercase("Hack Dylan!") => "HACK DYLAN!"
uppercase("Hack Dylan!", end: 4) => "HACK Dylan!"
-------------

.. generic-function:: uppercase!
:sealed:

Expand All @@ -813,7 +785,7 @@ Case Conversion Functions
.. code-block:: dylan
uppercase!('t') => 'T'
.. method:: uppercase!
:specializer: <string>
:sealed:
Expand All @@ -840,8 +812,6 @@ Case Conversion Functions
uppercase!("Hack Dylan!")
=> error, attempt to modify a string constant
-------------

.. generic-function:: uppercase?
:sealed:

Expand Down Expand Up @@ -1356,14 +1326,20 @@ Miscellaneous Functions
strip-right(" \tabc\n") => " \tabc"
strip-right("*foo*", test: curry(\=, '*')) => "*foo"
Other Useful Functions
======================
There are a number of functions outside the strings library itself that can be used with strings.
String Functions in Other Libraries
===================================

Built-In
--------
There are a number of functions outside the strings library itself that can be
used with strings.

dylan Module
------------

Since strings are a kind of :drm:`<sequence>`, all sequence operations apply to
strings, including most `Collection Operations
<https://opendylan.org/books/drm/Collection_Operations>`_. The ones listed
below are most frequently used for strings.

.. hlist::

Expand All @@ -1380,7 +1356,7 @@ Built-In
* :drm:`as-lowercase!`
* :drm:`as-uppercase`
* :drm:`as-uppercase!`

common-extensions Module
------------------------

Expand Down

0 comments on commit b76d11c

Please sign in to comment.