! * \brief Returns a substring [pos, pos+count) * \param pos The position of the first character to include * \param count The length of the substring (default: until end of string) * \return A string containing the substring */
| 653 | * \return A string containing the substring |
| 654 | */ |
| 655 | String substr(size_t pos = 0, size_t count = npos) const { |
| 656 | if (pos > size()) { |
| 657 | throw std::out_of_range("tvm::String substr index out of bounds"); |
| 658 | } |
| 659 | size_t rcount = std::min(count, size() - pos); |
| 660 | return String(data() + pos, rcount); |
| 661 | } |
| 662 | |
| 663 | /*! |
| 664 | * \brief Check if the string starts with a prefix |