src/string.h
branchnoai
changeset 9694 e72987579514
parent 9574 698395509d12
child 6868 7eb395287b3d
equal deleted inserted replaced
9693:31fcaa5375a1 9694:e72987579514
    22  * @param src string to copy
    22  * @param src string to copy
    23  * @param last pointer to the last element in the dst array
    23  * @param last pointer to the last element in the dst array
    24  *             if NULL no boundary check is performed
    24  *             if NULL no boundary check is performed
    25  * @return a pointer to the terminating \0 in the destination buffer
    25  * @return a pointer to the terminating \0 in the destination buffer
    26  */
    26  */
    27 char* strecat(char* dst, const char* src, const char* last);
    27 char *strecat(char *dst, const char *src, const char *last);
    28 char* strecpy(char* dst, const char* src, const char* last);
    28 char *strecpy(char *dst, const char *src, const char *last);
    29 
    29 
    30 char* CDECL str_fmt(const char* str, ...);
    30 char *CDECL str_fmt(const char *str, ...);
    31 
    31 
    32 /** Scans the string for valid characters and if it finds invalid ones,
    32 /** Scans the string for valid characters and if it finds invalid ones,
    33  * replaces them with a question mark '?' */
    33  * replaces them with a question mark '?' */
    34 void str_validate(char *str);
    34 void str_validate(char *str);
    35 
    35 
    47 
    47 
    48 /** Convert the given string to lowercase, only works with ASCII! */
    48 /** Convert the given string to lowercase, only works with ASCII! */
    49 void strtolower(char *str);
    49 void strtolower(char *str);
    50 
    50 
    51 
    51 
    52 static inline bool StrEmpty(const char* s) { return s[0] == '\0'; }
    52 static inline bool StrEmpty(const char *s) { return s[0] == '\0'; }
    53 
    53 
    54 
    54 
    55 /** Get the length of a string, within a limited buffer */
    55 /** Get the length of a string, within a limited buffer */
    56 static inline int ttd_strnlen(const char *str, int maxlen)
    56 static inline int ttd_strnlen(const char *str, int maxlen)
    57 {
    57 {