當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ReplacePattern.getReplaceString方法代碼示例

本文整理匯總了TypeScript中vs/platform/search/common/replace.ReplacePattern.getReplaceString方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ReplacePattern.getReplaceString方法的具體用法?TypeScript ReplacePattern.getReplaceString怎麽用?TypeScript ReplacePattern.getReplaceString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/platform/search/common/replace.ReplacePattern的用法示例。


在下文中一共展示了ReplacePattern.getReplaceString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('get replace string for no matches', () => {
		let testObject= new ReplacePattern('hello', {pattern: 'bla', isRegExp: true});
		let actual= testObject.getReplaceString('foo');
		assert.equal(null, actual);

		testObject= new ReplacePattern('hello', {pattern: 'bla', isRegExp: false});
		actual= testObject.getReplaceString('foo');
		assert.equal(null, actual);
	});
開發者ID:aminroosta,項目名稱:vscode,代碼行數:9,代碼來源:replace.test.ts

示例2: getReplaceString

	private getReplaceString(matchRange: Range): string {
		if (this._state.isRegex) {
			let regExp = TextModel.parseSearchRequest(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord);
			let replacePattern = new ReplacePattern(this._state.replaceString, true, regExp);
			let model = this._editor.getModel();
			let matchedString = model.getValueInRange(matchRange);
			let replacedString = replacePattern.getReplaceString(matchedString);
			// If matched string is not matching then regex pattern has a lookahead expression
			if (replacedString === null) {
				replacedString = replacePattern.getReplaceString(this._getTextToMatch(matchRange, regExp));
			}
			return replacedString;
		}
		return this._state.replaceString;
	}
開發者ID:GYGit,項目名稱:vscode,代碼行數:15,代碼來源:findModel.ts

示例3: getReplaceString

	private getReplaceString(matchedString:string): string {
		let replacePattern= new ReplacePattern(this._state.replaceString, {pattern: this._state.searchString, isRegExp: this._state.isRegex, isCaseSensitive: this._state.matchCase, isWordMatch: this._state.wholeWord});
		return replacePattern.getReplaceString(matchedString);
	}
開發者ID:iiunknown,項目名稱:vscode,代碼行數:4,代碼來源:findModel.ts


注:本文中的vs/platform/search/common/replace.ReplacePattern.getReplaceString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。