Okay, so when you say two characters, I'm assuming that you are referring to delimiters. In this case you would have to use String.find() to find the position of the delimiters. After finding the positions of the delimiters, you can can use String.substr(index1,index2-index1) to return the substring.
Example:
#include <iostream>
#include <string>
int main()
{
std::size_t index1,index2;
std::string myString = "sdfgkjr$joeisawesome$sdfeids";
std::string sub= "";
index1 = myString.find('$');
//string::npos is -1 if you are unaware
if(index1!=std::string::npos&& index1<myString.length()-1)
index2=myString.find('$',index1+1);
if(index2!=std::string::npos)
{
sub = myString.substr(index1+1,index2-index1);
}
std::cout<<sub; //outputs joeisawesome
}