本文整理汇总了TypeScript中common.Common.stringEndsWith方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Common.stringEndsWith方法的具体用法?TypeScript Common.stringEndsWith怎么用?TypeScript Common.stringEndsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.Common
的用法示例。
在下文中一共展示了Common.stringEndsWith方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isJsonXmlOrJavascript
function isJsonXmlOrJavascript(filePath) {
return Common.stringEndsWith(filePath, ".json") ||
Common.stringEndsWith(filePath, ".js") ||
Common.stringEndsWith(filePath, ".xml") ||
Common.stringEndsWith(filePath, ".project") ||
Common.stringEndsWith(filePath, ".classpath") ||
Common.stringEndsWith(filePath, ".index");
}
示例2: cleanResourcePath
export function cleanResourcePath(path) {
if(path != null) {
var cleanPath = path.replace(/\/+/, "/").replace(/\.#/, ""); // replace // with /
while(cleanPath.indexOf("//") != -1) {
cleanPath = cleanPath.replace("//", "/"); // remove double slashes like /x/y//z.snap
}
if(Common.stringEndsWith(cleanPath, "/")) {
cleanPath = cleanPath.substring(0,cleanPath.length-1);
}
return cleanPath;
}
return null;
}
示例3: isResourceFolder
export function isResourceFolder(path) {
if(!Common.stringEndsWith(path, "/")) {
var parts = path.split(".");
if(path.length === 1 || (parts[0] === "" && parts.length === 2)) {
return true;
}
var extension = parts.pop();
var slash = extension.indexOf('/');
return slash >= 0;
}
return true;
}
示例4: getFileContent
public getFileContent(): string {
if(this._fileContent) {
var filePath = this._resourcePath.getResourcePath();
var filePathToken = filePath.toLowerCase();
if(Common.stringEndsWith(filePathToken, ".json")) {
try {
var jsonObject = JSON.parse(this._fileContent);
return JSON.stringify(jsonObject, null, 3);
}catch(e) {
return this._fileContent;
}
}
return this._fileContent;
}
return "";
}
示例5: isJavaResource
function isJavaResource(libraryPath) {
return libraryPath && Common.stringEndsWith(libraryPath, ".jar");
}
示例6: resolveEditorMode
export function resolveEditorMode(resource) {
var token = resource.toLowerCase();
if(Common.stringEndsWith(token, ".snap")) {
return "ace/mode/snapscript";
}
if(Common.stringEndsWith(token, ".policy")) {
return "ace/mode/policy";
}
if(Common.stringEndsWith(token, ".xml")) {
return "ace/mode/xml";
}
if(Common.stringEndsWith(token, ".json")) {
return "ace/mode/json";
}
if(Common.stringEndsWith(token, ".sql")) {
return "ace/mode/sql";
}
if(Common.stringEndsWith(token, ".pl")) {
return "ace/mode/perl";
}
if(Common.stringEndsWith(token, ".kt")) {
return "ace/mode/kotlin";
}
if(Common.stringEndsWith(token, ".js")) {
return "ace/mode/javascript";
}
if(Common.stringEndsWith(token, ".ts")) {
return "ace/mode/typescript";
}
if(Common.stringEndsWith(token, ".java")) {
return "ace/mode/java";
}
if(Common.stringEndsWith(token, ".groovy")) {
return "ace/mode/groovy";
}
if(Common.stringEndsWith(token, ".py")) {
return "ace/mode/python";
}
if(Common.stringEndsWith(token, ".html")) {
return "ace/mode/html";
}
if(Common.stringEndsWith(token, ".htm")) {
return "ace/mode/html";
}
if(Common.stringEndsWith(token, ".txt")) {
return "ace/mode/text";
}
if(Common.stringEndsWith(token, ".properties")) {
return "ace/mode/properties";
}
if(Common.stringEndsWith(token, ".gitignore")) {
return "ace/mode/text";
}
if(Common.stringEndsWith(token, ".project")) {
return "ace/mode/xml";
}
if(Common.stringEndsWith(token, ".classpath")) {
return "ace/mode/text";
}
return "ace/mode/text";
}