int |
s.length() |
returns the length of string s.
|
bool |
s.empty() |
returns whether s is the empty string.
|
char& |
s[int i] |
returns the character at position i.
Precondition
0 < = i < = s.length()-1.
|
string |
s(int i, int j) |
returns the substring of s starting at
position max(0, i) and ending at
position min(j, s.length()-1).
If min(j, s.length()
-1) < max(0, i)
then the empty string is returned.
|
string |
s.head(int i) |
returns the first i characters of s.
|
string |
s.tail(int i) |
returns the last i characters of s.
|
int |
s.pos(string s1, int i) |
returns the minimum j such that j > = i and s1
is a substring of s starting at position j
(returns -1 if no such j exists).
|
int |
s.pos(const string& s1) |
returns pos(s1, 0).
|
bool |
s.contains(const string& s1) |
|
|
true iff s1 is a substring of s.
|
string |
s.insert(int i, string s1) |
|
|
returns s(0, i - 1) + s1 + s(i, s.length()-1).
|
string |
s.replace(const string& s1, const string& s2, int i=1) |
|
|
returns the string created from s by replacing
the i-th occurrence of s1 in s by s2.
Remark: The occurences of s1 in s are counted in a
non-overlapping manner, for instance the string sasas
contains only one occurence of the string sas.
|
string |
s.replace(int i, int j, const string& s1) |
|
|
returns the string created from s by replacing
s(i, j) by s1.
Preconditioni < = j.
|
string |
s.replace(int i, const string& s1) |
|
|
returns the string created from s by replacing
s[i] by s1.
|
string |
s.replace_all(const string& s1, const string& s2) |
|
|
returns the string created from s by replacing
all occurrences of s1 in s by s2.
PreconditionThe occurrences of s1 in s
do not overlap (it's hard to say what the function returns
if the precondition is violated.).
|
string |
s.del(const string& s1, int i=1) |
|
|
returns s.replace(s1,"", i).
|
string |
s.del(int i, int j) |
returns s.replace(i, j,"").
|
string |
s.del(int i) |
returns s.replace(i,"").
|
string |
s.del_all(const string& s1) |
|
|
returns s.replace_all(s1,"").
|
void |
s.read(istream& I, char delim = ' ') |
|
|
reads characters from input stream I into s
until the first occurrence of character delim.
(If delim is '
\ n' it is extracted
from the stream, otherwise it remains there.)
|
void |
s.read(char delim = ' ') |
same as s.read(cin,delim).
|
void |
s.read_line(istream& I) |
same as s.read(I,'
\ n').
|
void |
s.read_line() |
same as s.read_line(cin).
|
void |
s.read_file(istream& I) |
same as s.read(I,'EOF').
|
void |
s.read_file() |
same as s.read_file(cin).
|
string& |
s += const string& x |
appends x to s and returns a reference to s.
|
string |
const string& x + const string& y |
|
|
returns the concatenation of x and y.
|
bool |
const string& x == const string& y |
|
|
true iff x and y are equal.
|
bool |
const string& x != const string& y |
|
|
true iff x and y are not equal.
|
bool |
const string& x < const string& y |
|
|
true iff x is lexicographically smaller than y.
|
bool |
const string& x > const string& y |
|
|
true iff x is lexicographically greater than y.
|
bool |
const string& x <= const string& y |
|
|
returns
(x < y) | (x = = y).
|
bool |
const string& x >= const string& y |
|
|
returns
(x > y) | (x = = y).
|
istream& |
istream& I » string& s |
same as s.read(I,' ').
|
ostream& |
ostream& O « const string& s |
|
|
writes string s to the output stream O.
|