45 char* p =
new char[sz + 1];
46 std::memset(p, 0, sz + 1);
49 inline void MemSet(
void* p,
int n,
size_t sz) { std::memset(p,
n, sz); }
50 inline void MemCpy(
void* p,
const void* q,
size_t sz)
53 std::memcpy(p, q, sz);
60 inline size_t StringLen(
const char* s) {
return s ? std::strlen(s) : 0; }
65 const size_t n = std::strlen(s) + 1;
66 char* p =
new char[
n];
72 const size_t n = s.length();
73 char* p =
new char[
n + 1];
74 std::memcpy(p, s.data(),
n);
86 inline const char*
StringStr(
const char* s1,
const char* s2) {
return std::strstr(s1, s2); }
87 inline char*
StringStr(
char* s1,
const char* s2) {
return std::strstr(s1, s2); }
89 inline void StringCpy(
char* d,
const char* s) { std::strcpy(d, s); }
90 inline void StringNCpy(
char* d,
const char* s,
size_t n) { std::strncpy(d, s,
n); }
91 inline const char*
StringChr(
const char* s,
const char c) {
return std::strchr(s, c); }
92 inline char*
StringChr(
char* s,
const char c) {
return std::strchr(s, c); }
93 inline char*
StringRChr(
char* s,
const char c) {
return std::strrchr(s, c); }
95 inline int StringCmp(
const char* s1,
const char* s2)
133 const string S1(s1), S2(s2);
141 if ((
unsigned char)(*s++) >
' ')
The NCBI C++ standard methods for dealing with std::string.
int StringCmp(const char *s1, const char *s2)
bool StringDoesHaveText(const char *s)
void MemSet(void *p, int n, size_t sz)
char * StringSave(const char *s)
bool StringEquNI(const char *s1, const char *s2, size_t n)
bool StringEquN(const char *s1, const char *s2, size_t n)
bool StringEqu(const char *s1, const char *s2)
void StringCpy(char *d, const char *s)
void StringNCpy(char *d, const char *s, size_t n)
size_t StringLen(const char *s)
bool StringHasNoText(const char *s)
void StringCat(char *d, const char *s)
void MemCpy(void *p, const void *q, size_t sz)
char * StringRChr(char *s, const char c)
const char * StringChr(const char *s, const char c)
char * StringNew(size_t sz)
const char * StringStr(const char *s1, const char *s2)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
int strncmp(const char *str1, const char *str2, size_t count)
int strcmp(const char *str1, const char *str2)