You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Nicholas DeFazio (JIRA)" <ji...@apache.org> on 2015/08/06 21:19:14 UTC
[jira] [Created] (LANG-1161) StringUtils.startsWith returns true
for an empty string comparison
Nicholas DeFazio created LANG-1161:
--------------------------------------
Summary: StringUtils.startsWith returns true for an empty string comparison
Key: LANG-1161
URL: https://issues.apache.org/jira/browse/LANG-1161
Project: Commons Lang
Issue Type: Improvement
Affects Versions: 3.3
Reporter: Nicholas DeFazio
Priority: Trivial
When working on a project I noticed that...
{code}
boolean match = StringUtils.startsWith("abcdef", "");
System.out.println(match); //prints true
{code}
My thought was that a comparison of a non empty string to an empty string should result in a false, similar to how null is handled.
{code}
boolean match = StringUtils.startsWith("abcdef", null);
System.out.println(match); //prints false
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)