alice
library
manual.

Alice Project

The SUBSTRING signature


________ Synopsis ____________________________________________________

    signature SUBSTRING
    structure Substring : SUBSTRING where type char      = Char.t
				      and type string    = CharVector.t
				      and type substring = CharVectorSlice.t
  

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

See also: STRING, MONO_VECTOR_SLICE, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature SUBSTRING =
    sig
	eqtype char
	eqtype string
	type substring
	type t = substring							(**)

	val equal :       substring * substring -> bool
	val hash :        substring -> int

	val base :        substring -> string * int * int
	val string :      substring -> string
	val substring :   string * int * int -> substring
	val extract :     string * int * int option -> substring

	val isEmpty :     substring -> bool
	val size :        substring -> int

	val full :        string -> substring
	val getc :        substring -> (char * substring) option
	val first :       substring -> char option
	val triml :       int -> substring -> substring
	val trimr :       int -> substring -> substring
	val sub :         substring * int -> char
	val slice :       substring * int * int option -> substring
	val concat :      substring list -> string
	val explode :     substring -> char list

	val isPrefix :    string -> substring -> bool
	val isSuffix :    string -> substring -> bool
	val isSubstring : string -> substring -> bool
	val compare :     substring * substring -> order
	val collate :     (char * char -> order) -> substring * substring -> order

	val splitl :      (char -> bool) -> substring -> substring * substring
	val splitr :      (char -> bool) -> substring -> substring * substring
	val splitAt :     substring * int -> substring * substring
	val dropl :       (char -> bool) -> substring -> substring
	val dropr :       (char -> bool) -> substring -> substring
	val takel :       (char -> bool) -> substring -> substring
	val taker :       (char -> bool) -> substring -> substring

        val position :    string -> substring -> substring * substring
        val tokens :      (char -> bool) -> substring -> substring list
        val fields :      (char -> bool) -> substring -> substring list

	val span :        substring * substring -> substring
	val translate :   (char -> string) -> substring -> string

	val app :         (char -> unit) -> substring -> unit
	val appr :        (char -> unit) -> substring -> unit
	val foldl :       (char * 'a -> 'a) -> 'a -> substring -> 'a
	val foldr :       (char * 'a -> 'a) -> 'a -> substring -> 'a
    end
  

________ Description _________________________________________________

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

type t = substring

A local synonym for type substring.

equal (ss1, ss2)

Returns true if the substrings contain the same sequence of characters, false otherwise. Equivalent to string ss1 = string ss2.

hash ss

A hash function for substrings.

appr f ss

Like app, but applies f in right to left order (i.e., decreasing indices). Equivalent to:

        List.appr f (explode s)


last modified 2007/Mar/30 17:10