std::experi...iew::substr(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

std::experimental::basic_string_view::substr β€” std::experimental::basic_string_view::substr

bestie, welcome to the std::experi...iew::substr(3) page from the C++ Standard Libary πŸ’… this is your lowkey iconic substring-view moment, and we're gonna get through it together. 🫢


✨ Synopsis ✨

okay so here's the signature, copied exactly and looking cute:

          constexpr basic_string_view
              substr(size_type pos = 0, size_type count = npos ) const;

Basically this returns a view of the substring [pos, pos + rcount), where rcount is the smaller of count and size() - pos. That's the whole main character energy of it. πŸ’…


πŸŽ€ Parameters πŸŽ€

  • pos β€” position of the first character
  • count β€” requested length

🌈 Return value 🌈

View of the substring [pos, pos + rcount). Slay. ✨


πŸ’€ Exceptions πŸ’€

std::out_of_range if pos > size() β€” so like, do not go past the end, bestie, or it's gonna throw. 😭


⚑ Complexity ⚑

Constant. Literally constant, no cap. πŸ’…


πŸ¦‹ See also πŸ¦‹

  • copy β€” copies characters (public member function)
  • find β€” find characters in the view (public member function)

🌸 Category 🌸

* Noindexed pages


okay that's the whole page, bestie. It's giving std::experi...iew::substr(3) from http://cppreference.com, dated 2024.06.10. Go off and substring responsibly πŸ˜ŒπŸ’–

πŸ“¦ where this page comes from