diff options
author | nyamatongwe <unknown> | 2000-12-18 09:15:50 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-12-18 09:15:50 +0000 |
commit | 9f18dafb246a9f85ebbc34df95a1554286c3adaf (patch) | |
tree | 6d66b87b6c4ff216c93ebcc981b037bc7202afb2 | |
parent | 291acae278f95a0590ae617247abc5f3b429e44f (diff) | |
download | scintilla-mirror-9f18dafb246a9f85ebbc34df95a1554286c3adaf.tar.gz |
Added constructor from a const char * with start and end arguments.
-rw-r--r-- | include/SString.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/include/SString.h b/include/SString.h index bdc4548ba..b404725ba 100644 --- a/include/SString.h +++ b/include/SString.h @@ -71,6 +71,10 @@ public: s = StringDup(s_); ssize = (s) ? strlen(s) : 0; } + SString(const char *s_, int first, int last) { + s = StringDup(s_ + first, last - first); + ssize = (s) ? strlen(s) : 0; + } SString(int i) { char number[100]; sprintf(number, "%0d", i); @@ -163,8 +167,10 @@ public: char *t = s; while (t) { t = strchr(t, find); - if (t) + if (t) { *t = replace; + t++; + } } } //added by ajkc - 08122000 @@ -183,9 +189,7 @@ public: startPos = 0; if (startPos == endPos) { - //result += s[startPos]; - result += ""; // Why? -- Neil - return result; + return SString(""); } if (startPos > endPos) { @@ -193,15 +197,8 @@ public: endPos = startPos; startPos = tmp; } - - //printf("SString: substring startPos %d endPos %d\n",startPos,endPos); - for (int i = startPos; i < endPos; i++) { - //printf("SString: substring %d: %c\n",i,s[i]); - result += s[i]; - } - - //printf("SString: substring: returning: %s\n", result.c_str()); - return result; + + return SString(s, startPos, endPos); } // I don't think this really belongs here -- Neil void correctPath() { |