Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.temp.shared.utils;

public class StringUtils {
    public static String deNull(String pString) {
        return deNull(pString, "");
    }

    public static String deNull(String pString, String pDefault) {
        return (pString != null) ? pString : pDefault;
    }

    public static String noEmpty(String pString) {
        return ((pString = deNull(pString).trim()).length() != 0) ? pString : null;
    }

    /**
     * return the index of the first character that is unacceptable for that position to be part of an Identifier.
     *
     * An Identifier is a String that stars with a 7bit Alpha or underscore, and is followed by any number of 7bit AlphaNumerics or underscores.
     *
     * @param toCheck not null or empty
     *
     * @return -1 if OK, otherwise the 'bad' character index.
     */
    public static int checkIdentifier(String toCheck) {
        if (!CharacterUtils.is7bitAlphaUnderScore( toCheck.charAt( 0 ) )) {
            return 0;
        }
        for (int i = 1; i <toCheck.length(); i++) {
            if (!CharacterUtils.isAlphaNumericUnderScore7bitAscii( toCheck.charAt( i ) )) {
                return i;
            }
        }
        return -1;
    }
}

Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/utils/StringUtils.java

Diff revisions: vs.
Revision Author Commited Message
600 Diff Diff GeorgeS picture GeorgeS Sun 05 Feb, 2012 18:55:58 +0000

Sync-n

594 Diff Diff GeorgeS picture GeorgeS Sat 21 Jan, 2012 00:40:54 +0000
590 GeorgeS picture GeorgeS Thu 19 Jan, 2012 23:33:20 +0000

New FormEngine