MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / string_endswith

Function string_endswith

StereoKitC/libraries/stref.cpp:97–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95///////////////////////////////////////////
96
97bool string_endswith(const char *a, const char *end, bool case_sensitive) {
98 size_t len_a = strlen(a);
99 size_t len_end = strlen(end);
100 if (len_end > len_a)
101 return false;
102 a = a + (len_a - len_end);
103
104 if (!case_sensitive) {
105 while (*a != '\0' && *end != '\0') {
106 if (tolower(*a) != tolower(*end))
107 return false;
108 a++;
109 end++;
110 }
111 return tolower(*a) == tolower(*end);
112 } else {
113 while (*a != '\0' && *end != '\0') {
114 if (*a != *end)
115 return false;
116 a++;
117 end++;
118 }
119 return *a == *end;
120 }
121}
122
123///////////////////////////////////////////
124

Callers 6

file_picker_open_folderFunction · 0.85
render_save_to_fileFunction · 0.85
shader_create_fileFunction · 0.85
model_create_memFunction · 0.85
platform_push_path_newFunction · 0.85
platform_iterate_dirFunction · 0.85

Calls 1

strlenFunction · 0.85

Tested by

no test coverage detected