** Remove leading white spaces and shift everything to the left. */
| 450 | ** Remove leading white spaces and shift everything to the left. |
| 451 | */ |
| 452 | char *msStringTrimLeft(char *string) |
| 453 | { |
| 454 | char *read, *write; |
| 455 | int i, length; |
| 456 | |
| 457 | if (string && strlen(string) > 0) |
| 458 | { |
| 459 | length = strlen(string); |
| 460 | read = string; |
| 461 | write = string; |
| 462 | |
| 463 | for (i=0; i<length; i++) |
| 464 | { |
| 465 | if (isspace(string[i])) |
| 466 | read++; |
| 467 | else |
| 468 | break; |
| 469 | } |
| 470 | |
| 471 | if (read > write) |
| 472 | { |
| 473 | while (*read) |
| 474 | { |
| 475 | *write = *read; |
| 476 | read++; |
| 477 | write++; |
| 478 | } |
| 479 | *write = '\0'; |
| 480 | } |
| 481 | } |
| 482 | return string; |
| 483 | } |
| 484 | |
| 485 | /* ------------------------------------------------------------------------------- */ |
| 486 | /* Trims trailing blanks from a string */ |
no outgoing calls
no test coverage detected