Skip to content

Commit 159a340

Browse files
[tool] add IsStringNullOrEmpty()
1 parent 784f0d4 commit 159a340

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/framework/NetString.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,17 @@ namespace System
160160

161161
bool StartsWith(const String& s) const
162162
{
163+
if (String::IsNullOrEmpty(s)){
164+
return false;
165+
}
163166
return (IndexOf(s)==0);
164167
}
165168

166169
bool EndsWith(const String& s) const
167170
{
171+
if (String::IsNullOrEmpty(s)){
172+
return false;
173+
}
168174
return (IndexOf(s)==Length()-s.Length());
169175
}
170176

@@ -213,6 +219,11 @@ namespace System
213219
s.m_str.erase(s.m_str.find_first_not_of(" \n\r\t")+1);
214220
return s;
215221
}
222+
223+
static bool IsNullOrEmpty(const String &s)
224+
{
225+
retunr (s.Length()==0);
226+
}
216227
};
217228

218229
inline String operator+(const String& a, const String& b)

0 commit comments

Comments
 (0)