SourceForge.net Logo

Euphoria Standard Library
(ESL)

Home Page | Project Status | Contribute | Guidelines and Information



Euphoria Standard Library module:

string.e



1. Introduction


This is a collection of string manipulation routines. Some functions are very similar to some in seqops.e.



2. Routines

escape_chars

Syntax: s = escape_chars(s)
Description: Takes a string and returns the string but all characters that need to be escaped are (turns the string " \"' " to " \\\"\' ").
Status: PROPOSED


match_word

Syntax: i = match_word(w, s, delim_chars)
Description: Like Euphoria's match(), but only returns a value != 0 if w matches as "word". A word is considered a substring that is surrouned by any characters in the delim_chars list.
Status: PROPOSED


replace_substring

Syntax: s = replace_substring(source, whatToReplace, replaceWith, matchCase)
Description: Looks for all cases where match(whatToReplace, source) returns a value != 0, and replaces the sequence 'whatToReplace' with the sequence 'replaceWith'. If and only if the boolean flag 'matchCase' is TRUE, match()ing is case-sensitive. The (maybe changed) source string is returned.
Status: PROPOSED


replace_word

Syntax: s = replace_word(source, whatToReplace, replaceWith, matchCase, delimChars)
Description: Looks for all cases where match_word(whatToReplace, source) returns a value != 0, and replaces the sequence 'whatToReplace' with the sequence 'replaceWith'. If and only if the boolean flag 'matchCase' is TRUE, match()ing is case-sensitive. The (maybe changed) source string is returned.
Status: PROPOSED


split

Syntax: s = split(s1, s2)
Description: Returns a sequence where every element of s is from s2 but s2 has been divided using the string s1 as delimiter (e.g. split(" ", "this is a test") returns {"this", "is, "a", "test"}).
Status: PROPOSED


trim

Syntax: s = trim(s)
Description: Takes a string and returns the string minus leading and trailing spaces.
Status: PROPOSED


trim_left, trim_front, left_trim

Syntax: s = trim_left(s)
Description: Takes a string and returns the string minus leading spaces.
Status: PROPOSED


trim_right, trim_right, right_trim

Syntax: s = trim_right(s)
Description: Takes a string and returns the string minus trailing spaces.
Status: PROPOSED