• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StringUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: newNameConventionMismatchException

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
private TokenMgrError newNameConventionMismatchException(Token tok) {
    return new TokenMgrError(
            "Naming convention mismatch. "
            + "Identifiers that are part of the template language (not the user specified ones) "
            + (initialNamingConvention == Configuration.AUTO_DETECT_NAMING_CONVENTION
                ? "must consistently use the same naming convention within the same template. This template uses "
                : "must use the configured naming convention, which is the ")
            + (namingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION
                        ? "camel case naming convention (like: exampleName) "
                        : (namingConvention == Configuration.LEGACY_NAMING_CONVENTION
                                ? "legacy naming convention (directive (tag) names are like examplename, "
                                  + "everything else is like example_name) "
                                : "??? (internal error)"
                                ))
            + (namingConventionEstabilisher != null
                    ? "estabilished by auto-detection at "
                        + MessageUtil.formatPosition(
                                namingConventionEstabilisher.beginLine, namingConventionEstabilisher.beginColumn)
                        + " by token " + StringUtil.jQuote(namingConventionEstabilisher.image.trim())
                    : "")
            + ", but the problematic token, " + StringUtil.jQuote(tok.image.trim())
            + ", uses a different convention.",
            TokenMgrError.LEXICAL_ERROR,
            tok.beginLine, tok.beginColumn, tok.endLine, tok.endColumn);
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:26,代码来源:FMParserWSTokenManager.java


示例2: addSetting

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
public void addSetting(String name, String value) throws TemplateException {
    // Process all other init-params:
    if (name.equals(INITPARAM_NOCACHE)) {
        nocache = StringUtil.getYesNo(value);
    } else if (name.equals(INITPARAM_DEBUG)) {
        debug = StringUtil.getYesNo(value);
    } else if (name.equals(INITPARAM_CONTENT_TYPE)) {
        contentType = value;
    } else {
        config.setSetting(name, value);
    }

    if (contentType != null && !contentTypeEvaluated) {
        int i = contentType.toLowerCase().indexOf("charset=");
        contentTypeEvaluated = true;
        if (i != -1) {
            char c = ' ';
            i--;
            while (i >= 0) {
                c = contentType.charAt(i);
                if (!Character.isWhitespace(c)) break;
                i--;
            }
            if (i == -1 || c == ';') {
                noCharsetInContentType = false;
            }
        }
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:30,代码来源:FreemarkerManager.java


示例3: StringLiteral

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
final public StringLiteral StringLiteral(boolean interpolate) throws ParseException {
  Token t;
  boolean raw = false;
  switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
  case STRING_LITERAL:
    t = jj_consume_token(STRING_LITERAL);
    break;
  case RAW_STRING:
    t = jj_consume_token(RAW_STRING);
                         raw = true;
    break;
  default:
    jj_la1[17] = jj_gen;
    jj_consume_token(-1);
    throw new ParseException();
  }
      String s = t.image;
      // Get rid of the quotes.
      s = s.substring(1, s.length() -1);
      if (raw) {
          s = s.substring(1);
      } else try {
          s = StringUtil.FTLStringLiteralDec(s);
      } catch (ParseException pe) {
          pe.lineNumber = t.beginLine;
          pe.columnNumber = t.beginColumn;
          pe.endLineNumber = t.endLine;
          pe.endColumnNumber = t.endColumn;
          {if (true) throw pe;}
      }
      StringLiteral result = new StringLiteral(s);
      result.setLocation(template, t, t);
      if (interpolate && !raw) {
          // TODO: This logic is broken. It can't handle literals that contains both ${...} and $\{...}. 
          if (t.image.indexOf("${") >= 0 || t.image.indexOf("#{") >= 0) result.parseValue(token_source);
      }
      {if (true) return result;}
  throw new Error("Missing return statement in function");
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:40,代码来源:FMParserWS.java


示例4: getCustomTokenErrorDescription

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
private String getCustomTokenErrorDescription() {
    final Token nextToken = currentToken.next;
    final int kind = nextToken.kind;
    if (kind == EOF) {
        Set/*<String>*/ endNames = new HashSet();
        for (int i = 0; i < expectedTokenSequences.length; i++) {
            int[] sequence = expectedTokenSequences[i];
            for (int j = 0; j < sequence.length; j++) {
                switch (sequence[j]) {
                case END_FOREACH:
                    endNames.add( "#foreach");
                    break;
                case END_LIST:
                    endNames.add( "#list");
                    break;
                case END_SWITCH:
                    endNames.add( "#switch");
                    break;
                case END_IF:
                    endNames.add( "#if");
                    break;
                case END_COMPRESS:
                    endNames.add( "#compress");
                    break;
                case END_MACRO:
                    endNames.add( "#macro");
                case END_FUNCTION:
                    endNames.add( "#function");
                    break;
                case END_TRANSFORM:
                    endNames.add( "#transform");
                    break;
                case END_ESCAPE:
                    endNames.add( "#escape");
                    break;
                case END_NOESCAPE:
                    endNames.add( "#noescape");
                    break;
                case END_ASSIGN:
                    endNames.add( "#assign");
                    break;
                case END_LOCAL:
                    endNames.add( "#local");
                    break;
                case END_GLOBAL:
                    endNames.add( "#global");
                    break;
                case END_ATTEMPT:
                    endNames.add( "#attempt");
                    break;
                case CLOSING_CURLY_BRACKET:
                    endNames.add( "\"{\"");
                    break;
                case CLOSE_BRACKET:
                    endNames.add( "\"[\"");
                    break;
                case CLOSE_PAREN:
                    endNames.add( "\"(\"");
                    break;
                case UNIFIED_CALL_END:
                    endNames.add( "@...");
                    break;
                }
            }
        }
        return "Unexpected end of file reached."
                + (endNames.size() == 0 ? "" : " You have an unclosed " + concatWithOrs(endNames) + ".");
    } else if (kind == END_IF || kind == ELSE_IF || kind == ELSE) {
        return "Unexpected directive, "
                + StringUtil.jQuote(nextToken)
                + ". Check whether you have a valid #if-#elseif-#else structure.";
    }
    return null;
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:75,代码来源:ParseException.java


示例5: decToHex

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
public static String decToHex(int dec, int len){
    return StringUtil.leftPad(Integer.toHexString(dec).toUpperCase(Locale.ENGLISH), len, "0");
}
 
开发者ID:Manjago,项目名称:jmigration,代码行数:4,代码来源:BatExporter.java


示例6: process

import freemarker.template.utility.StringUtil; //导入依赖的package包/类
public void process(final String name, final TemplateModel model, final Locale locale, final Writer writer) throws IOException {
  debug("Requested template : [{}]", StringUtil.jQuoteNoXSS(name));

  final Template template = getTemplate(name, locale);

  process(template, model, writer);
}
 
开发者ID:Sabadios,项目名称:Cherry,代码行数:8,代码来源:FreeMarkerService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeConnectorId类代码示例发布时间:2022-05-23
下一篇:
Java IdeModifiableModelsProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap