java: new helper library for the Android port
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "CharUtil.hxx"
|
||||
#include "ASCII.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -65,6 +67,18 @@ StringEndsWith(const char *haystack, const char *needle)
|
||||
needle, needle_length) == 0;
|
||||
}
|
||||
|
||||
char *
|
||||
CopyString(char *gcc_restrict dest, const char *gcc_restrict src, size_t size)
|
||||
{
|
||||
size_t length = strlen(src);
|
||||
if (length >= size)
|
||||
length = size - 1;
|
||||
|
||||
char *p = std::copy(src, src + length, dest);
|
||||
*p = '\0';
|
||||
return p;
|
||||
}
|
||||
|
||||
bool
|
||||
string_array_contains(const char *const* haystack, const char *needle)
|
||||
{
|
||||
|
Reference in New Issue
Block a user