当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript string类代码示例

本文整理汇总了TypeScript中string的典型用法代码示例。如果您正苦于以下问题:TypeScript string类的具体用法?TypeScript string怎么用?TypeScript string使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了string类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: enableCodeCoverage

    // -----------------------------------------------------
    // Enable code coverage for Cobertura Ant Builds
    // - enableCodeCoverage: CodeCoverageProperties  - ccProps
    // -----------------------------------------------------    
    public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
        let _this = this;

        tl.debug("Input parameters: " + JSON.stringify(ccProps));

        _this.reportDir = "CCReport43F6D5EF";
        _this.reportbuildfile = "CCReportBuildA4D283EG.xml";
        _this.buildFile = ccProps["buildfile"];
        let classFilter = ccProps["classfilter"];
        let srcDirs = ccProps["sourcedirectories"];
        if (str(srcDirs).isEmpty()) {
            srcDirs = ".";
        }
        _this.sourceDirs = srcDirs;
        _this.classDirs = ccProps["classfilesdirectories"];

        let filter = _this.extractFilters(classFilter);
        _this.excludeFilter = _this.applyFilterPattern(filter.excludeFilter).join(",");
        _this.includeFilter = _this.applyFilterPattern(filter.includeFilter).join(",");

        tl.debug("Reading the build file: " + _this.buildFile);

        let buildContent = util.readXmlFileAsDom(_this.buildFile);
        return _this.addCodeCoverageData(buildContent)
            .thenResolve(true);
    }
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:30,代码来源:cobertura.ant.ccenabler.ts

示例2: createMultiModuleReport

    protected createMultiModuleReport(reportDir: string): Q.Promise<any> {
        let _this = this;
        let srcDirs = _this.sourceDirs;
        let classDirs = _this.classDirs;
        let includeFilter = _this.includeFilter.join(",");
        let excludeFilter = _this.excludeFilter.join(",");

        if (str(srcDirs).isEmpty()) {
            srcDirs = ".";
        }
        if (str(classDirs).isEmpty()) {
            classDirs = ".";
        }

        return util.writeFile(_this.reportBuildFile, ccc.jacocoMavenMultiModuleReport(reportDir, srcDirs, classDirs, includeFilter, excludeFilter));
    }
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:16,代码来源:jacoco.maven.ccenabler.ts

示例3: writeJsonAsXmlFile

export function writeJsonAsXmlFile(filePath: string, jsonContent: any): Q.Promise<void> {
    let builder = new xml2js.Builder();
    tl.debug("Writing JSON as XML file: " + filePath);
    let xml = builder.buildObject(jsonContent);
    xml = str(xml).replaceAll("&#xD;", "").s;
    return writeFile(filePath, xml);
}
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:7,代码来源:utilities.ts

示例4: coberturaMavenEnable

export function coberturaMavenEnable(includeFilter: string, excludeFilter: string, aggregate: string): Q.Promise<any> {
    let includeTag = "";
    let excludeTag = "";
    if (!str(excludeFilter).isEmpty()) {
        excludeFilter.split(",").forEach(ex => {
            excludeTag += `<exclude>${ex}</exclude>` + os.EOL;
        });
    }
    if (!str(includeFilter).isEmpty()) {
        includeFilter.split(",").forEach(ex => {
            includeTag += `<include>${ex}</include>` + os.EOL;
        });
    }

    let ccProperty = `
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <formats>
            <format>xml</format>
            <format>html</format>
          </formats>
          <instrumentation>
            <includes>${includeTag}</includes>
            <excludes>${excludeTag}</excludes>
          </instrumentation>
          <aggregate>${aggregate}</aggregate>
        </configuration>
        <executions>
          <execution>
            <id>package-9af52907-6506-4b87-b16a-9883edee41bc</id>
            <goals>
              <goal>cobertura</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
    </plugin>
  `;
    return util.convertXmlStringToJson(ccProperty);
};
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:43,代码来源:codecoverageconstants.ts

示例5: trimEnd

export function trimEnd(data: string, trimChar: string) {
    if (!trimChar || !data) {
        return data;
    }

    if (str(data).endsWith(trimChar)) {
        return data.substring(0, data.length - trimChar.length);
    } else {
        return data;
    }
}
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:11,代码来源:utilities.ts

示例6: getClassData

 protected getClassData(): string {
     let classData = "";
     this.classDirs.split(",").forEach(dir => {
         classData += `<fileset dir='${dir}' includes="${this.includeFilter}"  excludes="${this.excludeFilter}" />`;
         classData += os.EOL;
     });
     if (str(classData).isEmpty()) {
         classData += `<fileset dir='.'${this.includeFilter} ${this.excludeFilter} />`;
         classData += os.EOL;
     }
     return classData;
 }
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:12,代码来源:jacoco.ant.ccenabler.ts

示例7: applyFilterPattern

    protected applyFilterPattern(filter: string): string[] {
        let ccfilter = [];

        if (!util.isNullOrWhitespace(filter)) {
            str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
                if (exFilter) {
                    ccfilter.push(str(exFilter).endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
                }
            });
        }

        tl.debug("Applying the filter pattern: " + filter + " op: " + ccfilter);
        return ccfilter;
    }
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:14,代码来源:jacoco.maven.ccenabler.ts

示例8: getSourceFilter

 protected getSourceFilter(): string {
     let srcData = "";
     this.sourceDirs.split(",").forEach(dir => {
         if (!str(dir).isEmpty()) {
             srcData += `<fileset dir='${dir}'/>`;
             srcData += os.EOL;
         }
     });
     if (str(srcData).isEmpty()) {
         srcData = `<fileset dir='.'/>`;
         srcData += os.EOL;
     }
     return srcData;
 }
开发者ID:HSAR,项目名称:vso-agent-tasks,代码行数:14,代码来源:jacoco.ant.ccenabler.ts

示例9: enableForking

    protected enableForking(targetNode: any) {
        let _this = this;
        let testNodes = ["junit", "java", "testng", "batchtest"];
        let coverageNode = ccc.jacocoAntCoverageEnable(_this.reportDir);

        if (!str(_this.includeFilter).isEmpty()) {
            coverageNode.$.includes = _this.includeFilterExec;
        }
        if (!str(_this.excludeFilter).isEmpty()) {
            coverageNode.$.excludes = _this.excludeFilterExec;
        }

        if (targetNode.javac) {
            if (targetNode.javac instanceof Array) {
                targetNode.javac.forEach(jn => {
                    jn.$.debug = "true";
                });
            }
        }

        testNodes.forEach(tn => {
            if (!targetNode[tn]) {
                return;
            }
            _this.enableForkOnTestNodes(targetNode[tn], true);
            coverageNode[tn] = targetNode[tn];
            delete targetNode[tn];
            targetNode["jacoco:coverage"] = coverageNode;
        });
    }
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:30,代码来源:jacoco.ant.ccenabler.ts

示例10: toView

 toView(rgbInt: number)
 {
     if(rgbInt == null){
         return null;
     }
     
     var hex=rgbInt.toString(16);
     hex = S(hex).padLeft(6,'0');
     return '#'+hex;        
 }
开发者ID:richardnagle,项目名称:buildjs,代码行数:10,代码来源:hex-colour-value-converter.ts


注:本文中的string类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。