diff options
author | nyamatongwe <devnull@localhost> | 2000-12-18 09:15:50 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-12-18 09:15:50 +0000 |
commit | 5341ae0c567eaca1c4cd888eb66e8e09247e9632 (patch) | |
tree | 6d66b87b6c4ff216c93ebcc981b037bc7202afb2 | |
parent | c67068f8ffba7065fa20ef927f1f8b59a0345da9 (diff) | |
download | scintilla-mirror-5341ae0c567eaca1c4cd888eb66e8e09247e9632.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() { |