alice
library
manual.

Alice Project

The STRING signature


________ Synopsis ____________________________________________________

    signature STRING
    structure String : STRING where type string = string
                                and type char   = char
  

An extended version of the Standard ML Basis' STRING signature.

See also: MONO_VECTOR, SUBSTRING, StringCvt, ATOM, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature STRING =
    sig
	eqtype char
	eqtype string
	type t = string

	val maxSize :     int

	val size :        string -> int
	val str :         char -> string
	val sub :         string * int -> char
	val substring :   string * int * int -> string
	val extract :     string * int * int option -> string

	val op ^ :        string * string -> string
	val concat :      string list -> string
	val concatWith :  string -> string list -> string
	val implode :     char list -> string
	val explode :     string -> char list
	val tabulate :    int * (int -> char) -> string

	val map :         (char -> char) -> string -> string
	val translate :   (char -> string) -> string -> string
	val fields :      (char -> bool) -> string -> string list
	val tokens :      (char -> bool) -> string -> string list

	val op < :        string * string -> bool
	val op > :        string * string -> bool
	val op <= :       string * string -> bool
	val op >= :       string * string -> bool
	val equal :       string * string -> bool
	val compare :     string * string -> order
	val collate :     (char * char -> order) -> string * string -> order
	val hash :        string -> int

	val isPrefix :    string -> string -> bool
	val isSuffix :    string -> string -> bool
	val isSubstring : string -> string -> bool

	val toString :    string -> string
	val toCString :   string -> string
	val fromString :  string -> string option
	val fromCString : string -> string option
	val scan :        (char,'a) StringCvt.reader -> (string,'a) StringCvt.reader
	val scanC :       (char,'a) StringCvt.reader -> (string,'a) StringCvt.reader
    end
  

________ Description _________________________________________________

Items not described here are as in the Standard ML Basis' STRING signature.

type t = string

A local synonym for type string.

tabulate (n, f)

Creates a string of size n, where the characters are defined in order of increasing index by applying f to the character's index. This is equivalent to the expression:

        implode (List.tabulate (n, f))

If n < 0 or maxSize < n, then the Size exception is raised.

equal (s1, s2)

An explicit equality function on strings. Equivalent to op=.

hash s

A hash function for strings.

scan getc strm
scanC getc strm

Scans a string as an SML (C) source program string, converting escape sequences into the appropriate characters. These functions are similar to fromString and fromCString, but can convert from arbitrary streams.



last modified 2007/Mar/30 17:10