Skip to content

Commit b7442ab

Browse files
committed
string helper
1 parent ca0abe5 commit b7442ab

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/string_lib.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,15 @@ long StringToLong(const char *str)
309309

310310
return result;
311311
}
312+
313+
/*********************************************************************/
314+
315+
char *NULLStringToEmpty(char *str)
316+
{
317+
if(!str)
318+
{
319+
return "";
320+
}
321+
322+
return str;
323+
}

src/string_lib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ char *ToLowerStr(const char *str);
3333
void ToLowerStrInplace(char *str);
3434

3535
long StringToLong(const char *str);
36+
char *NULLStringToEmpty(char *str);
3637

3738
bool IsNumber(const char *name);
3839

0 commit comments

Comments
 (0)