Main Page   Class Hierarchy   Compound List   Compound Members  

Utilities Class Reference

List of all members.

Static Public Methods

string entityReferences (const string &s)
string trim (const string &s)
 remove the trailing spaces from string s if there are some.

vector< string > splitString (const string &s, char c)
 split a string by unescaped char.

string escapeChar (const string &s, char c)
 escape all char c in string s.


Detailed Description

Utilities class defines some commonly used functions. Utilities class defines some commonly used functions, such as trim, escapeChar, etc. All the functions are static.
Author:
Xiaoyi Ma


Member Function Documentation

string Utilities::entityReferences const string &    s [static]
 

entityReferences converts the special characters in a string to their entity references so that the string can be a legal HTML or XML string. Certain characters, such as the left bracket (<), ampersand (&), etc. are reserved by HTML, SGML and XML to represent special attributes such as the start of HTML elements, graphic characters, and so on.

HTML allows special referencing to represent these special characters. These are indicated by either character references or entity references.

Entity references use symbolic names to represent the characters. Entity references have three parts:

   1. a leading ampersand character, (&), 
   2. the name of the entity (in ascii characters) 
   3. a terminating semicolon (;). 
 
Thus the entity reference for less than symbol (<) is <.
See also:
http://www.w3c.org for details.