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 vsprintf(string, format, args);
53 void concatx(typed_object object, ...)
55 // TODO: improve this to work directly on the Array<char> instead of calling PrintStdArgsToBuffer
56 char string[MAX_F_STRING];
59 va_start(args, object);
60 len = PrintStdArgsToBuffer(string, sizeof(string), object, args);
65 void copySingleBlankReplTrim(String s, char replace, bool trim)
67 privateCommonCopyLenSingleBlankReplTrim(s, replace, trim, strlen(s));
70 void copyLenSingleBlankReplTrim(String s, char replace, bool trim, int copyLen)
72 privateCommonCopyLenSingleBlankReplTrim(s, replace, trim, Min(strlen(s), copyLen));
75 void privateCommonCopyLenSingleBlankReplTrim(String s, char replace, bool trim, int len)
80 for(c = d = 0; c < len; c++)
87 /*array*/this[d++] = replace ? replace : s[c];
92 /*array*/this[d++] = s[c];
97 if(!trim || (len && !isblank(/*array*/this[d])))
99 /*array*/this[d] = '\0';