MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / trim

Function trim

Source/Utility/IniFile.cpp:257–290  ·  view source on GitHub ↗

Remove the specified characters from p_string

Source from the content-addressed store, hash-verified

255// Remove the specified characters from p_string
256//*****************************************************************************
257static bool trim( char * p_string, const char * p_trim_chars )
258{
259 u32 num_trims = strlen( p_trim_chars );
260 char * pin = p_string;
261 char * pout = p_string;
262 bool found;
263 while ( *pin )
264 {
265 char c = *pin;
266
267 found = false;
268 for ( u32 i = 0; i < num_trims; i++ )
269 {
270 if ( p_trim_chars[ i ] == c )
271 {
272 // Skip
273 found = true;
274 break;
275 }
276 }
277
278 if ( found )
279 {
280 pin++;
281 }
282 else
283 {
284 // Copy
285 *pout++ = *pin++;
286 }
287 }
288 *pout = '\0';
289 return true;
290}
291
292//*****************************************************************************
293//

Callers 1

OpenMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected