Index: Source/devtools/front_end/TextUtils.js |
diff --git a/Source/devtools/front_end/TextUtils.js b/Source/devtools/front_end/TextUtils.js |
index e603a0c54226f94ee6e19420eb8ed1abaabf703a..917e91ab26231f37374b372dfbdc5cf04b7bc18f 100644 |
--- a/Source/devtools/front_end/TextUtils.js |
+++ b/Source/devtools/front_end/TextUtils.js |
@@ -98,7 +98,24 @@ WebInspector.TextUtils = { |
isBraceChar: function(char) |
{ |
return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.TextUtils.isClosingBraceChar(char); |
- } |
+ }, |
+ |
+ textToWords: function(text) |
+ { |
+ var words = []; |
+ var startWord = -1; |
+ for(var i = 0; i < text.length; ++i) { |
+ if (!WebInspector.TextUtils.isWordChar(text.charAt(i))) { |
+ if (startWord !== -1) |
+ words.push(text.substring(startWord, i)); |
+ startWord = -1; |
+ } else if (startWord === -1) |
+ startWord = i; |
+ } |
+ if (startWord !== -1) |
+ words.push(text.substring(startWord)); |
+ return words; |
+ }, |
} |
WebInspector.TextUtils._SpaceCharRegex = /\s/; |