MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / trim

Method trim

Engine/source/core/util/str.cpp:1305–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1303//-----------------------------------------------------------------------------
1304
1305String String::trim() const
1306{
1307 if( isEmpty() )
1308 return *this;
1309
1310 const StringChar* start = _string->utf8();
1311 while( *start && dIsspace( *start ) )
1312 start ++;
1313
1314 const StringChar* end = _string->utf8() + length() - 1;
1315 while( end > start && dIsspace( *end ) )
1316 end --;
1317 end ++;
1318
1319 const U32 len = end - start;
1320 if( len == length() )
1321 return *this;
1322
1323 StringData* sub;
1324 if( !len )
1325 sub = StringData::Empty();
1326 else
1327 sub = StringData::Create(start, len);
1328
1329 return sub;
1330}
1331
1332//-----------------------------------------------------------------------------
1333

Callers 5

jquery.jsFile · 0.80
simObject.cppFile · 0.80
dumpFunctionFunction · 0.80
TESTFunction · 0.80
createMethod · 0.80

Calls 5

dIsspaceFunction · 0.85
CreateFunction · 0.85
lengthFunction · 0.50
EmptyFunction · 0.50
utf8Method · 0.45

Tested by 1

TESTFunction · 0.64