Currently, since std::string::String does not contain a substring function, we have adhered to a more "unconventional" approach to substring a string. The approach is as follows:
Declare a vector Vec<char> and push characters to the vector through an iterator.
Currently, since
std::string::String
does not contain asubstring
function, we have adhered to a more "unconventional" approach to substring a string. The approach is as follows:Vec<char>
and push characters to the vector through an iterator.String::from_iter
function to convert the vector into a string.There are other more traditional approaches to this; examples such as Java's
String.substring
function comes to mind.The idea behind this issue is to create a custom utility function for
substring
or bring in a crate and integrate it to the current codebase.