Gizmo wrote:
hello all have been trying to write a Mid() function a bit like the one in
vb.
First question: Why? What's wrong with std::string function substr()
which does exactly the same.
string substr (size_type pos, size_type n);
Returns a substring of the current string, starting at position pos and
of length n:
Example:
------------------------------------------------------
#include <iostream>
#include <string>
int main()
{
std::string str18 = "abcdefghi";
std::string str19 = str18.substr(6,2);
std::cout << str19 << std::endl; // Prints out: "gh"
return 0;
}
------------------------------------------------------