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


Java StringUtils.isEmpty方法代码示例

本文整理汇总了Java中org.parboiled.common.StringUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isEmpty方法的具体用法?Java StringUtils.isEmpty怎么用?Java StringUtils.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.parboiled.common.StringUtils的用法示例。


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

示例1: formatLocalDateFromZonedDate

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
/**
 * Formats a ZonedDateTime into a string with the given DateTimeFormatter pattern
 * @param date
 * @param formatPattern
 * @return
 */
public static String formatLocalDateFromZonedDate(ZonedDateTime date, String formatPattern) {
    if (date == null) {
        return "";
    }

    ZonedDateTime localDt = date.withZoneSameInstant(Context.getSettings().getTimeZoneId());

    DateTimeFormatter formatter;
    if (StringUtils.isEmpty(formatPattern)) {
        formatter = DEFAULT_FORMAT;
    } else if ("iso".equals(formatPattern.toLowerCase())) {
        formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
    } else {
        formatter = DateTimeFormatter.ofPattern(formatPattern);
    }
    return localDt.format(formatter);
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:24,代码来源:DateUtils.java

示例2: serialize

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
@Override
public void serialize(final VerbatimNode node, final Printer printer) {
    printer.println().print("<pre><code");
    String className = "prettyprint";
    if (!StringUtils.isEmpty(node.getType())) {
        className = className.concat(" " + node.getType());
    }
    printAttribute(printer, "class", className);
    printer.print(">");
    String text = node.getText();
    // print HTML breaks for all initial newlines
    while (text.charAt(0) == '\n') {
        printer.print("<br/>");
        text = text.substring(1);
    }
    printer.printEncoded(text);
    printer.print("</code></pre>");

}
 
开发者ID:microacup,项目名称:microbbs,代码行数:20,代码来源:PrettifyVerbatimSerializer.java

示例3: main

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
    TimeParser parser = Parboiled.createParser(TimeParser.class);
    
    while (true) {
        System.out.print("Enter a time expression (hh:mm(:ss)?, hh(mm(ss)?)? or h(mm)?, single RETURN to exit)!\n");
        String input = new Scanner(System.in).nextLine();
        if (StringUtils.isEmpty(input)) break;

        ParsingResult<?> result = new RecoveringParseRunner(parser.Time()).run(input);

        System.out.println(input + " = " + result.parseTreeRoot.getValue() + '\n');
        System.out.println(printNodeTree(result) + '\n');

        if (!result.matched) {
            System.out.println(StringUtils.join(result.parseErrors, "---\n"));
        }
    }
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:19,代码来源:Main.java

示例4: main

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
    AbcParser parser = Parboiled.createParser(AbcParser.class);

    while (true) {
        System.out.print("Enter an a^n b^n c^n expression (single RETURN to exit)!\n");
        String input = new Scanner(System.in).nextLine();
        if (StringUtils.isEmpty(input)) break;

        ParsingResult<?> result = new ReportingParseRunner(parser.S()).run(input);

        if (!result.parseErrors.isEmpty())
            System.out.println(ErrorUtils.printParseError(result.parseErrors.get(0)));
        else
            System.out.println(printNodeTree(result) + '\n');
    }
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:17,代码来源:Main.java

示例5: main

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
    TimeParser parser = Parboiled.createParser(TimeParser.class);
    
    while (true) {
        System.out.print("Enter a time expression (hh:mm(:ss)?, hh(mm(ss)?)? or h(mm)?, single RETURN to exit)!\n");
        String input = new Scanner(System.in).nextLine();
        if (StringUtils.isEmpty(input)) break;

        ParsingResult<?> result = new RecoveringParseRunner(parser.time()).run(input);

        System.out.println(input + " = " + result.parseTreeRoot.getValue() + '\n');
        System.out.println(printNodeTree(result) + '\n');

        if (!result.matched) {
            System.out.println(StringUtils.join(result.parseErrors, "---\n"));
        }
    }
}
 
开发者ID:parboiled1,项目名称:parboiled-examples,代码行数:19,代码来源:Main.java

示例6: printActionClassLines

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
private List<String> printActionClassLines() {
    List<String> lines = new ArrayList<String>();
    int anonymous = 0;
    for (Class<?> actionClass : actionClasses) {
        String name = actionClass.getSimpleName();
        if (StringUtils.isEmpty(name)) {
            anonymous++;
        } else {
            lines.add(name + " : " + StringUtils.join(printActionClassInstances(actionClass), ", "));
        }
    }
    Collections.sort(lines);
    if (anonymous > 0) lines.add("and " + anonymous + " anonymous instance(s)");
    return lines;
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:16,代码来源:ParserStatistics.java

示例7: main

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
public static <V, P extends CalculatorParser<V>> void main(Class<P> parserClass) {
    CalculatorParser<V> parser = Parboiled.createParser(parserClass);

    while (true) {
        System.out.print("Enter a calculators expression (single RETURN to exit)!\n");
        String input = new Scanner(System.in).nextLine();
        if (StringUtils.isEmpty(input)) break;

        ParsingResult<?> result = new RecoveringParseRunner(parser.InputLine()).run(input);

        if (result.hasErrors()) {
            System.out.println("\nParse Errors:\n" + printParseErrors(result));
        }

        Object value = result.parseTreeRoot.getValue();
        if (value != null) {
            String str = value.toString();
            int ix = str.indexOf('|');
            if (ix >= 0) str = str.substring(ix + 2); // extract value part of AST node toString()
            System.out.println(input + " = " + str + '\n');
        }
        if (value instanceof GraphNode) {
            System.out.println("\nAbstract Syntax Tree:\n" +
                    printTree((GraphNode) value, new ToStringFormatter(null)) + '\n');
        } else {
            System.out.println("\nParse Tree:\n" + printNodeTree(result) + '\n');
        }
    }
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:31,代码来源:CalculatorParser.java

示例8: getLabelText

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
public String getLabelText(RuleMethod method) {
    if (method.visibleAnnotations != null) {
        for (Object annotationObj : method.visibleAnnotations) {
            AnnotationNode annotation = (AnnotationNode) annotationObj;
            if (annotation.desc.equals(Types.LABEL_DESC) && annotation.values != null) {
                checkState("value".equals(annotation.values.get(0)));
                String labelValue = (String) annotation.values.get(1);
                return StringUtils.isEmpty(labelValue) ? method.name : labelValue;
            }
        }
    }
    return method.name;
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:14,代码来源:LabellingGenerator.java

示例9: format

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
public String format(Node<V> node) {
    String nodeLabel = node.toString();
    String nodeText = StringUtils.escape(ParseTreeUtils.getNodeText(node, inputBuffer));
    return StringUtils.isEmpty(nodeText) ? nodeLabel : nodeLabel + " '" + nodeText + '\'';
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:6,代码来源:NodeFormatter.java

示例10: render

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
@Override
public Rendering render(ExpLinkNode node, String text) {
    Rendering rendering = new Rendering(MarkdownLinkResolver.resolveLink(node.url), text);
    return StringUtils.isEmpty(node.title) ? rendering : rendering.withAttribute("title", encode(node.title));
}
 
开发者ID:voostindie,项目名称:magisto,代码行数:6,代码来源:MarkdownLinkRenderer.java

示例11: of

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
/**
 * Creates a new Characters instance containing only the given chars.
 *
 * @param chars the chars
 * @return a new Characters object
 */
public static Characters of(String chars) {
    return StringUtils.isEmpty(chars) ? Characters.NONE : new Characters(false, chars.toCharArray());
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:10,代码来源:Characters.java

示例12: allBut

import org.parboiled.common.StringUtils; //导入方法依赖的package包/类
/**
 * Creates a new Characters instance containing all characters minus the given ones.
 *
 * @param chars the chars to NOT include
 * @return a new Characters object
 */
public static Characters allBut(String chars) {
    return StringUtils.isEmpty(chars) ? Characters.ALL : new Characters(true, chars.toCharArray());
}
 
开发者ID:parboiled1,项目名称:parboiled,代码行数:10,代码来源:Characters.java


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