Example usage for java.lang String trim

List of usage examples for java.lang String trim

Introduction

In this page you can find the example usage for java.lang String trim.

Prototype

public String trim() 

Source Link

Document

Returns a string whose value is this string, with all leading and trailing space removed, where space is defined as any character whose codepoint is less than or equal to 'U+0020' (the space character).

Usage

From source file:Main.java

/**
 * Trims the string and drops the beginning hash mark (#)
 * @param comment// www. j  a  v a  2  s  .c  o  m
 * @return
 */
private static String removePrecedingHashes(String comment) {
    return comment.trim().substring(1);
}

From source file:Main.java

private static String removeBracketPair(String value) {
    String str = value.trim();
    // Assume existing both brackets
    return str.substring(1, str.length() - 1);
}

From source file:Main.java

public static long getHanziCount(String pin1yin1) {
    return (long) pin1yin1.trim().split("-").length;
}

From source file:Main.java

public static boolean notEmpty(String s) {
    return (s != null && s.trim().length() > 0);
}

From source file:Main.java

public static String makeProperFormat(String iString) {
    iString = iString.trim();
    iString = iString.toLowerCase();/*from w  w  w.j ava  2s.c o  m*/
    iString = iString.substring(0, 1).toUpperCase() + iString.substring(1);
    return iString;
}

From source file:Main.java

public static boolean isSigntureMatches(String signture) {
    signture = signture.trim();
    return signture.length() <= SIGNTURE_MAX_LENGTH;
}

From source file:Main.java

public static boolean isEmpty(String s) {
    return (s == null || s.trim().isEmpty());
}

From source file:Main.java

public static boolean IsEmptyOrNullString(String s) {
    return (s == null) || (s.trim().length() == 0);
}

From source file:Utils.java

public static String stripCDATA(String s) {
    s = s.trim();
    if (s.startsWith("<![CDATA[")) {
        s = s.substring(9);/*  w ww  .jav  a  2s.c  o m*/
        int i = s.indexOf("]]&gt;");
        if (i == -1) {
            throw new IllegalStateException("argument starts with <![CDATA[ but cannot find pairing ]]&gt;");
        }
        s = s.substring(0, i);
    }
    return s;
}

From source file:Main.java

public static String getEntityClass(String classname) {
    String[] t = classname.trim().split("\\.");
    return t[t.length - 1];
}