Index: src/string.js |
diff --git a/src/string.js b/src/string.js |
index e22c93b90391e12e12fcdd9f5462124ed18b7a67..2fe17f8e5ed814680f00f2d79df55a5cccc9a686 100644 |
--- a/src/string.js |
+++ b/src/string.js |
@@ -557,7 +557,7 @@ function StringSplit(separator, limit) { |
// ECMA-262 says that if separator is undefined, the result should |
// be an array of size 1 containing the entire string. SpiderMonkey |
- // and KJS have this behaviour only when no separator is given. If |
+ // and KJS have this behavior only when no separator is given. If |
Erik Corry
2010/03/15 12:57:48
!@*%$
|
// undefined is explicitly given, they convert it to a string and |
// use that. We do as SpiderMonkey and KJS. |
if (%_ArgumentsLength() === 0) { |
@@ -572,18 +572,7 @@ function StringSplit(separator, limit) { |
// If the separator string is empty then return the elements in the subject. |
if (separator_length === 0) return %StringToArray(subject); |
- var result = []; |
- var start_index = 0; |
- var index; |
- while (true) { |
- if (start_index + separator_length > length || |
- (index = %StringIndexOf(subject, separator, start_index)) === -1) { |
- result.push(SubString(subject, start_index, length)); |
- break; |
- } |
- if (result.push(SubString(subject, start_index, index)) === limit) break; |
- start_index = index + separator_length; |
- } |
+ var result = %StringSplit(subject, separator, limit); |
return result; |
} |