c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Compile time string functions

Open lerno opened this issue 2 years ago • 1 comments

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.

lerno avatar Jul 06 '23 21:07 lerno

@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).

data-man avatar Jul 22 '23 17:07 data-man

Substring already works out of the box using compile time slices.

lerno avatar Oct 09 '25 15:10 lerno

All of those now essentially exists.

lerno avatar Oct 09 '25 20:10 lerno