MCPcopy Create free account
hub / github.com/MyGUI/mygui / normalize_space

Function normalize_space

Tools/EditorFramework/pugixml.cpp:7279–7307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7277}
7278
7279PUGI__FN void normalize_space(char_t* buffer)
7280{
7281 char_t* write = buffer;
7282
7283 for (char_t* it = buffer; *it;)
7284 {
7285 char_t ch = *it++;
7286
7287 if (PUGI__IS_CHARTYPE(ch, ct_space))
7288 {
7289 // replace whitespace sequence with single space
7290 while (PUGI__IS_CHARTYPE(*it, ct_space))
7291 it++;
7292
7293 // avoid leading spaces
7294 if (write != buffer)
7295 *write++ = ' ';
7296 }
7297 else
7298 *write++ = ch;
7299 }
7300
7301 // remove trailing space
7302 if (write != buffer && PUGI__IS_CHARTYPE(write[-1], ct_space))
7303 write--;
7304
7305 // zero-terminate
7306 *write = 0;
7307}
7308
7309PUGI__FN void translate(char_t* buffer, const char_t* from, const char_t* to)
7310{

Callers 1

eval_stringMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected