Edinburgh Speech Tools  2.1-release
Utility functions for strings

Functions

void StringtoStrList (EST_String s, EST_StrList &l, EST_String sep)
 Convert a EST_String to a EST_StrList by separating tokens in s delimited by the separator sep. By default, the string is assumed to be delimited by whitespace. More...
 
void BracketStringtoStrList (EST_String s, EST_StrList &l, EST_String sep)
 Convert a EST_String enclosed in a single set of brackets to a EST_StrList by separating tokens in s delimited by the separator sep. By default, the string is assumed to be delimited by whitespace. More...
 
EST_read_status load_StrList (EST_String filename, EST_StrList &l)
 Load tokens from a file and return them in a EST_StrList. More...
 
EST_write_status save_StrList (EST_String filename, EST_StrList &l, EST_String style)
 Save tokens from a EST_StrList. If style is set to "lines" each item is stored on a separate line, otherwise each item is separated by a single space. More...
 
void strip_quotes (EST_String &s, const EST_String quote_char="\"")
 remove quotes from a string More...
 
EST_String itoString (int n)
 Make a EST_String object from an integer. More...
 
EST_String ftoString (float n, int pres=3, int width=0, int l=0)
 Make a EST_String object from an float, with variable precision. More...
 
int Stringtoi (EST_String s)
 Make an int from a EST_String. EST_String equivalent of atoi() More...
 
int StrListtoIList (EST_StrList &s, EST_IList &il)
 Convert a list of strings to a list of integers. More...
 
int StrListtoFList (EST_StrList &s, EST_FList &f)
 Convert a list of strings to a list of floats. More...
 
void StrList_to_StrVector (EST_StrList &l, EST_StrVector &v)
 Convert a list of strings to a vector of strings. More...
 
void StrVector_to_StrList (EST_StrVector &v, EST_StrList &l)
 Convert a vector of strings to a list of strings. More...
 
long int StrVector_index (const EST_StrVector &v, const EST_String &s)
 Search the vector and return the position of the first occurance of string s in the vector. More...
 
int strlist_member (const EST_StrList &l, const EST_String &s)
 Return true if s is in list l. More...
 
long int strlist_index (const EST_StrList &l, const EST_String &s)
 Search the vector and return the position of the first occurance of string s in the list. More...
 
EST_String basename (EST_String full, EST_String ext="")
 This acts like the bourne shell basename command. By default, it strips any leading path from a string. If ext is defined, it strips any suffix matching this string. More...
 

Detailed Description

Function Documentation

void StringtoStrList ( EST_String  s,
EST_StrList l,
EST_String  sep = "" 
)

Convert a EST_String to a EST_StrList by separating tokens in s delimited by the separator sep. By default, the string is assumed to be delimited by whitespace.

Parameters
sString to be split.
lStringList the separated tokens will be stored.
sepToken delimiter. By default, whitespace is used.

Definition at line 100 of file EST_slist_aux.cc.

void BracketStringtoStrList ( EST_String  s,
EST_StrList l,
EST_String  sep = "" 
)

Convert a EST_String enclosed in a single set of brackets to a EST_StrList by separating tokens in s delimited by the separator sep. By default, the string is assumed to be delimited by whitespace.

Definition at line 93 of file EST_slist_aux.cc.

EST_read_status load_StrList ( EST_String  filename,
EST_StrList l 
)

Load tokens from a file and return them in a EST_StrList.

Definition at line 128 of file EST_slist_aux.cc.

EST_write_status save_StrList ( EST_String  filename,
EST_StrList l,
EST_String  style = "words" 
)

Save tokens from a EST_StrList. If style is set to "lines" each item is stored on a separate line, otherwise each item is separated by a single space.

Definition at line 148 of file EST_slist_aux.cc.

void strip_quotes ( EST_String s,
const EST_String  quote_char = "\"" 
)

remove quotes from a string

Definition at line 191 of file util_io.cc.

EST_String itoString ( int  n)

Make a EST_String object from an integer.

Definition at line 141 of file util_io.cc.

EST_String ftoString ( float  n,
int  pres = 3,
int  width = 0,
int  l = 0 
)

Make a EST_String object from an float, with variable precision.

Definition at line 149 of file util_io.cc.

int Stringtoi ( EST_String  s)

Make an int from a EST_String. EST_String equivalent of atoi()

Definition at line 131 of file util_io.cc.

int StrListtoIList ( EST_StrList s,
EST_IList il 
)

Convert a list of strings to a list of integers.

Definition at line 73 of file EST_slist_aux.cc.

int StrListtoFList ( EST_StrList s,
EST_FList f 
)

Convert a list of strings to a list of floats.

Definition at line 55 of file EST_slist_aux.cc.

void StrList_to_StrVector ( EST_StrList l,
EST_StrVector v 
)

Convert a list of strings to a vector of strings.

Definition at line 210 of file EST_slist_aux.cc.

void StrVector_to_StrList ( EST_StrVector v,
EST_StrList l 
)

Convert a vector of strings to a list of strings.

Definition at line 224 of file EST_slist_aux.cc.

int StrVector_index ( const EST_StrVector v,
const EST_String s 
)

Search the vector and return the position of the first occurance of string s in the vector.

Definition at line 233 of file EST_slist_aux.cc.

int strlist_member ( const EST_StrList l,
const EST_String s 
)

Return true if s is in list l.

Definition at line 186 of file EST_slist_aux.cc.

int strlist_index ( const EST_StrList l,
const EST_String s 
)

Search the vector and return the position of the first occurance of string s in the list.

Definition at line 196 of file EST_slist_aux.cc.

EST_String basename ( EST_String  full,
EST_String  ext = "" 
)

This acts like the bourne shell basename command. By default, it strips any leading path from a string. If ext is defined, it strips any suffix matching this string.

Definition at line 167 of file util_io.cc.