| SMLDoc |
structure Utility =
struct
exception MissingEscapedChar
val interleave
val interleaveString
val isPrefixOf
val splitLast
val sort
val uniq
val satisfyAny
val satisfyAll
val compareStringNoCase
val tokenizeString
val replaceString
val replaceStringByTable
val replaceFile
end
Value detail |
---|
fun interleave separator list
separator
list
fun interleaveString separator strings
String.concatWith
in the SMLBasis library provides
the same functionality, but this function is not implemented by some
version of SML/NJ.
separator
string
fun isPrefixOf (left, right)
left
right
left
is a prefix of the
right
.
fun splitLast list
Example:
splitLast [1, 2, 3, 4]returns
([1, 2, 3], 4)
list
list
has n elements.
fun sort comparator list
ToDo : use efficient algorithm.
comparator
list
fun uniq list
list
fun satisfyAny conditions value
conditions
'a -> bool
value
value
.
fun satisfyAll conditions value
conditions
'a -> bool
value
value
.
fun compareStringNoCase (left, right)
String.collate
left
right
order
fun tokenizeString isDelimiter string
Example:
tokenizeString Char.isSpace " --header=Generated\\ by\\ SMLDoc\\ 1.0 foo.sml "returns
["--header=Generated by SMLDoc 1.0","foo.sml"]A charcter following a backslash is treated as an ordinary char.
isDelimiter
string
MissingEscapedChar
fun replaceString oldString newString string
example:
- Utility.replaceString "foo" "bar" "fooboofooboofoo"; val it = (3,"barboobarboobar") : int * string
oldString
newString
oldString
are
replaced with newString
val replaceStringByTable
fun replaceFile keyValuePairs (srcFileName, destFileName)
keyValuePairs
with the second element of that pair.
The result of replace is output to the destination file.
keyValuePairs
srcFileName
destFileName
Exception detail |
---|
exception MissingEscapedChar
tokenizeString
if the string ends with
a unescaped backslash.
| SMLDoc: Documentation generator for SML |