MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / normalize_space

Function normalize_space

Source/ThirdParty/pugixml/pugixml.cpp:7493–7519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7491 }
7492
7493 PUGI__FN char_t* normalize_space(char_t* buffer)
7494 {
7495 char_t* write = buffer;
7496
7497 for (char_t* it = buffer; *it; )
7498 {
7499 char_t ch = *it++;
7500
7501 if (PUGI__IS_CHARTYPE(ch, ct_space))
7502 {
7503 // replace whitespace sequence with single space
7504 while (PUGI__IS_CHARTYPE(*it, ct_space)) it++;
7505
7506 // avoid leading spaces
7507 if (write != buffer) *write++ = ' ';
7508 }
7509 else *write++ = ch;
7510 }
7511
7512 // remove trailing space
7513 if (write != buffer && PUGI__IS_CHARTYPE(write[-1], ct_space)) write--;
7514
7515 // zero-terminate
7516 *write = 0;
7517
7518 return write;
7519 }
7520
7521 PUGI__FN char_t* translate(char_t* buffer, const char_t* from, const char_t* to, size_t to_length)
7522 {

Callers 1

eval_stringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected