MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / trim_right

Function trim_right

inst/include/Rcpp/sugar/functions/strings/trimws.h:52–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52inline const char* trim_right(const char* str, R_len_t sz, std::string* buff) {
53 if (!str) {
54 return "";
55 }
56
57 buff->clear();
58 const char* ptr = str + sz - 1;
59
60 for (; ptr > str && isws(*ptr); --sz, --ptr);
61
62 buff->append(str, sz - isws(*ptr));
63 return buff->c_str();
64}
65
66inline const char* trim_both(const char* str, R_len_t sz, std::string* buff) {
67 if (!str) {

Callers 1

trimwsFunction · 0.85

Calls 2

iswsFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected