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

private static boolean isWord(String s) {
    return s.trim().contains(" ");
}

From source file:Main.java

public static String toEscapedString(String ip) {
    return ip.trim().replaceAll("\\.", "_");
}

From source file:Main.java

private static boolean endsWithRightParenthesis(String str) {
    return str.trim().endsWith(")");
}

From source file:Main.java

public static boolean isEmpty(String str) {
    return str.trim().equals("");
}

From source file:Main.java

public static boolean numvalid(String num) {
    return num.trim().length() < 10 ? false : true;
}

From source file:Main.java

public static String removeBOM(String xml) {
    return xml.trim().replaceFirst("^([\\W]+)<", "<"); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:Main.java

public static long getWordCount(String sent) {
    return sent.trim().split("\\W+").length;
}

From source file:Main.java

public static String getTelNums(String tel) {
    return tel.trim().replaceAll(phoneCharactersPattern, "");
}

From source file:Main.java

private static String toProperCase(String s) {
    return s.trim().substring(0, 1).toUpperCase(Locale.getDefault())
            + s.substring(1).toLowerCase(Locale.getDefault());
}

From source file:Main.java

public static String textFormat(String text) {
    return text.trim();
}