MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / StripLeadingTrailingSpaces

Function StripLeadingTrailingSpaces

editor/HFile.cpp:542–564  ·  view source on GitHub ↗

Strips leading and trailing spaces from a string Returns true if spaces were stripped

Source from the content-addressed store, hash-verified

540// Strips leading and trailing spaces from a string
541// Returns true if spaces were stripped
542bool StripLeadingTrailingSpaces(char *s) {
543 char *t;
544 bool stripped = 0;
545
546 // Look for leading spaces
547 t = s;
548 while (*t == ' ')
549 t++;
550
551 // Leading spaces found, so copy string over spaces
552 if (t != s) {
553 strcpy(s, t);
554 stripped = 1;
555 }
556
557 // Strip any trailing spaces
558 for (t = s + strlen(s) - 1; (t >= s) && (*t == ' '); t--) {
559 *t = 0;
560 stripped = 1;
561 }
562
563 return stripped;
564}
565
566// Check for duplicate names in the level
567void CheckLevelNames() {

Callers 4

CheckLevelNamesFunction · 0.85
OnCommandMethod · 0.85
OnTrigEditNameMethod · 0.85
RenameRoomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected