Here you can find the source of startsWithLetterOrUnderscore(String value)
public static boolean startsWithLetterOrUnderscore(String value)
//package com.java2s; /******************************************************************************* * Copyright (c) 2011-2015 Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w.j a v a 2 s . c om*/ * Red Hat, Inc. - initial API and implementation ******************************************************************************/ public class Main { public static boolean startsWithLetterOrUnderscore(String value) { if (isEmpty(value)) { return false; } char character = value.charAt(0); return character == '_' || Character.isLetter(character); } /** * Returns true if value is null or empty string. * @param value * @return */ public static boolean isEmpty(String value) { return value == null || value.length() == 0; } public static boolean isEmpty(Object value) { return (value instanceof String) && isEmpty((String) value); } }