9 if (destination == source || num == 0) {
17 FW_ASSERT(source + source_len <= destination || destination + num <= source);
19 char* returned = strncpy(destination, source, static_cast<size_t>(num));
20 destination[num - 1] =
'\0';
27 for (length = 0; length < buffer_size; length++) {
28 if (source[length] ==
'\0') {
37 const CHAR* sub_string,
43 if ((source_size > 0) && (0 == sub_size)) {
48 if (source_size < sub_size) {
52 FW_ASSERT(static_cast<FwSignedSizeType>(source_size - sub_size) <= std::numeric_limits<FwSignedSizeType>::max());
56 source_index < (source_size - sub_size + 1) &&
57 source_index < static_cast<FwSizeType>(std::numeric_limits<FwSignedSizeType>::max());
60 for (
FwSizeType sub_index = 0; sub_index < sub_size; sub_index++) {
62 FW_ASSERT((source_index + sub_index) < source_size);
64 if (source_string[source_index + sub_index] != sub_string[sub_index]) {
66 }
else if (sub_index == (sub_size - 1)) {
FwSignedSizeType substring_find(const CHAR *source_string, FwSizeType source_size, const CHAR *sub_string, FwSizeType sub_size)
find the first occurrence of a substring
PlatformSizeType FwSizeType
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
PlatformSignedSizeType FwSignedSizeType
FwSizeType string_length(const CHAR *source, FwSizeType buffer_size)
get the length of the source string