c3c
c3c copied to clipboard
Compile time string functions
In order to facilitate certain types of macros, the following macros could be built in:
- [x]
@str_to_upper(#f)Convert string to upper case. - [x]
@str_to_lower(#f)Convert string to lower case. - [ ]
@str_to_var_name(#f, #space)Convert string to camel case from a space-based name scheme. - [ ]
@str_to_type_name(#f, #space)Convert string to title case from a space-based name scheme. - [ ]
@str_from_name(#f, #space)Convert title case or lower camel case to a space based scheme. - [ ]
@str_replace(#str, #pattern, #replacement, #count)Replace a string with another. - [ ]
@sub_string(#str, #start, #length)Return a substring of a compile time string. - [x]
@str_find(#str, #stringToFind)Find a substring in a compile time string. - [x]
@str_hash(#str)Return the FNV1a hash of a string. - [ ]
@str_len(#str)Return a compile time length of a string.
@str_to_var_name(#f, #space) Convert string to camel case from a space-based name scheme. @str_to_type_name(#f, #space) Convert string to title case from a space-based name scheme.
I propose rename them to @str_to_camel_case(#f, #space) and @str_to_title_case(#f, #space).
Substring already works out of the box using compile time slices.
All of those now essentially exists.