Correct logical expression to avoid throwing a NullPointerException on a null input.
This commit is contained in:
parent
16d14cb86c
commit
524aeb7676
1 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@ public class TitleCase {
|
|||
"to","of","by","at","for","but","in","with","has","de","von"};
|
||||
|
||||
public static String toTitleCase(String in){
|
||||
if( in == null && in.length() ==0 )
|
||||
if( in == null || in.length() ==0 )
|
||||
return in;
|
||||
|
||||
in = in.toLowerCase();
|
||||
|
@ -80,7 +80,7 @@ public class TitleCase {
|
|||
}
|
||||
|
||||
private static String capitalizeWord(String in){
|
||||
if( in == null && in.length() == 0 )
|
||||
if( in == null || in.length() == 0 )
|
||||
return in;
|
||||
if( in.length() == 1 )
|
||||
return in.toUpperCase();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue