Here's the code working:
string string_pick(string text, string tag, char caractere)
{
int index = text.IndexOf(tag);
return text.Substring(index + tag.Length, text.IndexOf(caractere, index + tag.Length + 1) - (index + tag.Length));
}
Example of operation:
string x = "kkkkkkkkkkkk jjjjjjjjjjj oloco icaro alguma coisa algumas palavras várias loucuras name:'icaro' lalala huhuasd sdiufhidf sdifuhisuhdf kkkkkkk";
string temporaria = string_pick(x,"name:'",'\'');
Temporary will be icaro.
Well, as you're going to mess with a gigantic string, I'd like to just access that part of memory and not copy the string again (in case the function's argument0 is doing).
In C ++ I solved it like this:
string string_pick(string *text, string tag, char caractere)
{
int index = (*text).find(tag);
return (*text).substr(index + tag.length(), (*text).find(caractere, index + tag.length() + 1) - (index + tag.length()));
}