Skip to content

Feature/104258 str functions #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37962d2
feat: 104258: initial partial implementation of str functions
FlufflesTheMicrosaur Aug 8, 2025
4f213e4
feat: 104258: simplify some logic with initial functions, fix some bugs
FlufflesTheMicrosaur Aug 8, 2025
d5c5d0b
feat: 104258: add strJoin and strReplace. strReplace currently has an…
FlufflesTheMicrosaur Aug 9, 2025
b23b9e3
fix: 104258: fix strReplace off by one error
FlufflesTheMicrosaur Aug 9, 2025
2c32c02
feat: 104258: add strSlice strStrip strSplit
FlufflesTheMicrosaur Aug 9, 2025
349c70d
chore: 104258: remove unnecessary checks, improve line spacing to mat…
FlufflesTheMicrosaur Aug 9, 2025
991189e
chore: 104258: more cleanup
FlufflesTheMicrosaur Aug 9, 2025
ab46671
chore: 104258: add docs to version.h
FlufflesTheMicrosaur Aug 9, 2025
d025ff3
chore: 104258: add warning about no api check
FlufflesTheMicrosaur Aug 9, 2025
9831a2a
fix: 104258: fix negative pointer offset in Kernel::strSubString
FlufflesTheMicrosaur Aug 9, 2025
41b2cd2
feat: 104258: add strSubStringWrapAround for KernelString.h to be use…
FlufflesTheMicrosaur Aug 9, 2025
009136f
feat: 104258: add strSlice to KernelString
FlufflesTheMicrosaur Aug 10, 2025
6e30560
feat: 104332: shareable case sensitive implementation of strCompareAb…
FlufflesTheMicrosaur Aug 10, 2025
9d47b31
Merge remote-tracking branch 'origin/feature/case_sensitive_strCompar…
FlufflesTheMicrosaur Aug 10, 2025
a6ff97e
feat: add strStartsWith/strEndsWith using common code, deprecated old…
FlufflesTheMicrosaur Aug 11, 2025
212394a
feat: 104258: switch args on strJoin to match join, switch strBeginsW…
FlufflesTheMicrosaur Aug 11, 2025
075e8af
feat: 104258: slice & subset improvements for both strings and lists
FlufflesTheMicrosaur Aug 11, 2025
0e90c79
feat: 104258: add strFindAll, improves docs, enable case sensitive op…
FlufflesTheMicrosaur Aug 11, 2025
ea18084
chore: 104258: add subset and slice list unittests
FlufflesTheMicrosaur Aug 11, 2025
92a0af6
chore: 104258: add unit tests for str version of subset and slice, an…
FlufflesTheMicrosaur Aug 11, 2025
3186952
fix: 104258: fix bug with strJoin, add tests for strSplit, strStrip, …
FlufflesTheMicrosaur Aug 11, 2025
d41cd7e
fix: 104258: off-by-one edgecase in strReplace
FlufflesTheMicrosaur Aug 11, 2025
f3dfc1f
Merge branch 'master' into feature/104258-strFunctions
FlufflesTheMicrosaur Aug 12, 2025
ea73b1a
fix: 104358: fix merge issue where DWToRGBColor was renamed to DWToAR…
FlufflesTheMicrosaur Aug 15, 2025
6a59693
Revert "fix: 104358: fix merge issue where DWToRGBColor was renamed t…
FlufflesTheMicrosaur Aug 15, 2025
633b2bd
chore 104258: cleanup strSplit code, add additional test cases for st…
FlufflesTheMicrosaur Aug 16, 2025
6c2f451
Chore: 104258: fix some comments to use the same spacing existing com…
FlufflesTheMicrosaur Aug 16, 2025
ff44fee
chore: 104258: refactor strReplace to use new str functions instead …
FlufflesTheMicrosaur Aug 16, 2025
dbc687a
chore: 104258: refactor strStrip into a kernel function so it can be …
FlufflesTheMicrosaur Aug 16, 2025
2abe717
chore: 104258: remove strJoin for implementation in more advanced for…
FlufflesTheMicrosaur Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 48 additions & 6 deletions Alchemy/CodeChain/DefPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,15 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"(setq variable value)",
NULL, PPFLAG_SIDEEFFECTS, },

{ "slice", fnSubset, FN_SUBSET_SLICE,
"(subset list start [end]) -> list\n"
"(subset string start [end]) -> string\n\n"

"Creates a list or string of the elements or characters starting at index pos up until index end.\n"
"Negative indexes are allowed and wrap around (-1 is the last element, -2 is the next last element, etc).\n"
"An empty version of the provided type is returned if there are no elements or characters to copy.",
"vi*", 0, },

{ "shuffle", fnShuffle, 0,
"(shuffle list) -> shuffled list",
"l", 0, },
Expand All @@ -420,13 +429,42 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"(sqrtn x) -> real z",
"n", 0, },

{ "strBeginsWith", fnStr, FN_STR_BEGINS_WITH,
"(strBeginsWith string target [caseSensitive=Nil]) -> True|Nil",
"ss*", 0,},

{ "strCapitalize", fnStrCapitalize,0,
"(strCapitalize string) -> string",
NULL, PPFLAG_SIDEEFFECTS, },

{ "strFind", fnStrFind, 0,
"(strFind string target) -> pos of target in string (0-based)",
"ss", 0, },
{ "strCount", fnStr, FN_STR_COUNT,
"(strCount string target [caseSensitive=Nil]) -> int",
"ss*", 0,},

{ "strEndsWith", fnStr, FN_STR_ENDS_WITH,
"(strEndsWith string target [caseSensitive=Nil]) -> True|Nil",
"ss*", 0,},

{ "strFind", fnStr, FN_STR_FIND,
"(strFind string target [caseSensitive=Nil]) -> pos of target in string (0-based)",
"ss*", 0, },

{ "strFindAll", fnStr, FN_STR_FINDALL,
"(strFindAll string target [caseSensitive=Nil]) -> list of all target pos in string (0-based). If none, Nil.",
"ss*", 0, },

{ "strReplace", fnStr, FN_STR_REPLACE,
"(strReplace string target replacement [caseSensitive=Nil]) -> string",
"ssv*", PPFLAG_SIDEEFFECTS,},

{ "strStrip", fnStr, FN_STR_STRIP,
"(strStrip string [characters] [caseSensitive=Nil]) -> string with characters to strip removed from either end. Strips whitespace by default.",
"s*", PPFLAG_SIDEEFFECTS,},

{ "strSplit", fnStr, FN_STR_SPLIT,
"(strSplit string delimiter [caseSensitive=Nil]) -> list of strings split around delimiter.\n"
"Leaves empty strings where appropriate, including at the beginning and ends if it starts or ends with a delimiter string.",
"sv*", PPFLAG_SIDEEFFECTS,},

{ "struct", fnStruct, FN_STRUCT,
"(struct key1 value1 [ key2 value2 ...]) -> struct\n"
Expand All @@ -445,9 +483,13 @@ static PRIMITIVEPROCDEF g_DefPrimitives[] =
"Same as struct except values of the same key are appended into a list.",
"*", 0, },

{ "subset", fnSubset, 0,
"(subset list pos [count]) -> list\n"
"(subset string pos [count]) -> string",
{ "subset", fnSubset, FN_SUBSET_SUBSET,
"(subset list pos [count] ['-|'empty]) -> list\n"
"(subset string pos [count] ['-|'empty]) -> string\n\n"

"Creates a list or string of remaining (or count) length of the elements or characters starting at index pos.\n"
"'- specifies that negative indexes are allowed and wrap around (-1 is the last element, -2 is the next last element, etc).\n"
"'empty specifies that an empty version of the provided type is returned if there are no elements or characts to copy.",
"vv*", 0, },

{ "subst", fnSubst, 0,
Expand Down
Loading