In this article, we’ll explore six practical string processing operations introduced in C++20 and C++23. These features represent an evolution in this crucial area, covering a spectrum of operations from searching and appending to creation and stream handling.
Six Handy Operations for String Processing in C++20/23
by Bartlomiej Filipek
From the article:
Let’s start with a simple yet long-awaited feature…
1.
contains()
, C++23Finally, after decades of standardization, we have a super easy way to check if there’s one string inside the other. No need to use
.find(str) != npos
!Before C++23:
And now, thanks to the proposal: P1679R3:
As you can see, the new approach with contains()
is more straightforward and intuitive.
Add a Comment
Comments are closed.