Skip to content
jacktrades edited this page Jan 3, 2012 · 1 revision

srfi13

srfi13 is a Javascript implementation of the SRFI-13 string library for Scheme. This is a 'just for fun' implementation and probably shouldn't be used in production work.

The spec for SRFI-13 can be found here.

Naming

Javascript allows far fewer special characters in variable/property names, therefore the following conventions have been used:

  • '-' characters in procedure names have been changed to '_'
  • procedures which end in a '?' use the 'is_' prefix and do not have a '?'

Differences

destructive operations
Javascript does not have mutable strings so any SRFI-13 procedure ending in '!' will not be implemented.

index values
As in Python, index values may be negative. A negative index value resolves to (string.length + -index).

make_string
make_string in SRFI-13 creates a string with a default fill value. This is of little use in Javascript which has immutable strings, so make_string has the same functionality as string_tabulate.

titlecase
titlecase uses a more complex implementation than what is required by SRFI-13. (Implementation by David Gouch http://individed.com)

string-lib-internals
Low-level procedures have not yet been implemented.

Additions

starts_with and ends_with
Implementations of Python's startswith and endswith.

Clone this wiki locally