HHH-13549 Simplify StringHelper#isQuoted
This commit is contained in:
parent
de8d6d095f
commit
85d4ffda14
|
@ -604,10 +604,15 @@ public final class StringHelper {
|
||||||
*
|
*
|
||||||
* @return True if the given string starts and ends with '`'; false otherwise.
|
* @return True if the given string starts and ends with '`'; false otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean isQuoted(String name) {
|
public static boolean isQuoted(final String name) {
|
||||||
return name != null && name.length() != 0
|
if ( name == null || name.isEmpty() ) {
|
||||||
&& ( ( name.charAt( 0 ) == '`' && name.charAt( name.length() - 1 ) == '`' )
|
return false;
|
||||||
|| ( name.charAt( 0 ) == '"' && name.charAt( name.length() - 1 ) == '"' ) );
|
}
|
||||||
|
|
||||||
|
final char first = name.charAt( 0 );
|
||||||
|
final char last = name.charAt( name.length() - 1 );
|
||||||
|
|
||||||
|
return ( ( first == last ) && ( first == '`' || first == '"' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue