r/cpp • • Jul 23 '22

finally. #embed

https://thephd.dev/finally-embed-in-c23
353 Upvotes

202 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jul 23 '22

[deleted]

4

u/[deleted] Jul 23 '22

Functions I have to copy/paste into most code bases:

  • replace all occurrences of substring by new substring

  • trim whitespace or other characters from left/right/both

  • convert entire string to lower/upper case

  • split a string by spaces/comma/substring

I would have added "begins with" and "ends with" to that list, but that recently made it into the standard, yay.

0

u/[deleted] Jul 24 '22

[deleted]

4

u/dodheim Jul 24 '22

Yeah sadly I don't think we can do that easily.

It already just works; in fact it's what the cppreference example for views::split does.