3 extern int isblank(int c);
5 class DynamicString : Array<char>
21 int len = strlen(value) + 1;
23 memcpy(s.array, value, len);
36 if(pos == -1) { Add('\0'); pos = 0; }
38 memcpy(&(this[pos]), s, len+1);
42 void concatf(char * format, ...)
44 // TODO: improve this to vsprinf directly in the Array<char> instead of calling concat
45 char string[MAX_F_STRING];
47 va_start(args, format);
48 vsnprintf(string, sizeof(string), format, args);
49 string[sizeof(string)-1] = 0;
54 void concatx(typed_object object, ...)
56 // TODO: improve this to work directly on the Array<char> instead of calling PrintStdArgsToBuffer
57 char string[MAX_F_STRING];
60 va_start(args, object);
61 len = PrintStdArgsToBuffer(string, sizeof(string), object, args);
66 void copySingleBlankReplTrim(String s, char replace, bool trim)
68 privateCommonCopyLenSingleBlankReplTrim(s, replace, trim, strlen(s));
71 void copyLenSingleBlankReplTrim(String s, char replace, bool trim, int copyLen)
73 privateCommonCopyLenSingleBlankReplTrim(s, replace, trim, Min(strlen(s), copyLen));
76 void privateCommonCopyLenSingleBlankReplTrim(String s, char replace, bool trim, int len)
81 for(c = d = 0; c < len; c++)
88 /*array*/this[d++] = replace ? replace : s[c];
93 /*array*/this[d++] = s[c];
98 if(!trim || (len && !isblank(/*array*/this[d])))
100 /*array*/this[d] = '\0';