Remove the specified characters from p_string
| 255 | // Remove the specified characters from p_string |
| 256 | //***************************************************************************** |
| 257 | static 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 | // |