Timeline for Case insensitive sub-string search
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 16, 2017 at 14:29 | history | edited | Toby Speight | CC BY-SA 3.0 |
Add a sentence to explain why I wrote shorter_than()
|
Nov 16, 2017 at 14:06 | comment | added | chux |
shorter_than() is clever!
|
|
Nov 16, 2017 at 10:18 | history | edited | Toby Speight | CC BY-SA 3.0 |
Add some test macros, for real diagnostics
|
Nov 16, 2017 at 9:41 | history | edited | Toby Speight | CC BY-SA 3.0 |
Extra tests for some edge cases; also add some explanation of how I chose the tests
|
Nov 16, 2017 at 9:28 | history | edited | Toby Speight | CC BY-SA 3.0 |
istrstr is a reserved identifier, too!
|
Nov 16, 2017 at 9:21 | comment | added | Toby Speight |
@chux, I've updated with something loosely based on that suggestion. I did first try strnlen_s() from Annex K, but that's not widely implemented - if you care for that, you can see it in the edit history.
|
|
Nov 16, 2017 at 9:15 | history | edited | Toby Speight | CC BY-SA 3.0 |
Annex K isn't that widespread, so just implement our own shorter_than() function
|
Nov 16, 2017 at 8:18 | history | edited | Toby Speight | CC BY-SA 3.0 |
Add Annex K strnlen_s() for better efficiency; thanks @chux
|
Nov 15, 2017 at 20:11 | comment | added | chux |
if (strlen(str) < substr_len) is an expensive check as code is obliged to scan the entire str . This does not hurt worst case performance much, but consider long strings that often have a match. Perhaps a strlen_limited(str, substrlen) that does not run passed substrlen ?
|
|
Nov 15, 2017 at 14:20 | history | edited | Toby Speight | CC BY-SA 3.0 |
Finish my sentence
|
Nov 15, 2017 at 12:35 | history | answered | Toby Speight | CC BY-SA 3.0 |