文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Search
A class designed to handle all sorts of text searches within a Document
.
Constructors
- new Search()
Creates a new Search
object. The following search options are available:
needle
: The string or regular expression you're looking forbackwards
: Whether to search backwards from where cursor currently is. Defaults tofalse
.wrap
: Whether to wrap the search back to the beginning when it hits the end. Defaults tofalse
.caseSensitive
: Whether the search ought to be case-sensitive. Defaults tofalse
.wholeWord
: Whether the search matches only on whole words. Defaults tofalse
.range
: TheRange
to search within. Set this tonull
for the whole documentregExp
: Whether the search is a regular expression or not. Defaults tofalse
.start
: The startingRange
or cursor position to begin the searchskipCurrent
: Whether or not to include the current line in the search. Default tofalse
.
Methods
- Search.find(EditSession session)
- 返回值: Range
Searches for options.needle
. If found, this method returns the Range
where the text first occurs. If options.backwards
is true
, the search goes backwards in the session.
session | EditSession | Required. The session to search with |
- Search.findAll(EditSession session)
- 返回值: Range
Searches for all occurances options.needle
. If found, this method returns an array of Range
s where the text first occurs. If options.backwards
is true
, the search goes backwards in the session.
session | EditSession | Required. The session to search with |
- Search.getOptions()
- 返回值: Object
Returns an object containing all the search options.
Searches for options.needle
in input
, and, if found, replaces it with replacement
.
input | String | Required. The text to search in |
replacement | String | Required. The replacing text
|
Sets the search options via the options
parameter.
options | Object | Required. An object containing all the new search properties |
- Search.setOptions()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论