MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / trimleftn

Function trimleftn

SIP/SIPParse.cpp:54–58  ·  view source on GitHub ↗

Return the index of the first char not in trimchars, or if none, of the trailing nul in the string. Note that if you trimleft and trimright a string of spaces, the two indicies would cross, so be careful. See trimboth.

Source from the content-addressed store, hash-verified

52// Return the index of the first char not in trimchars, or if none, of the trailing nul in the string.
53// Note that if you trimleft and trimright a string of spaces, the two indicies would cross, so be careful. See trimboth.
54size_t trimleftn(const char *startp, size_t startpos/*=0*/, const char *trimchars /*=" \t\r\n"*/)
55{
56 while (startp[startpos] && strchr(trimchars,startp[startpos])) { startpos++; }
57 return startpos;
58}
59
60// Trim both ends of a string.
61string trimboth(string input, const char *trimchars /*=" \t\r\n"*/)

Callers 1

trimbothFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected