in my opinion it is a common scenario
the string is something like :
"this is my story, if it's interesting [email protected] so thanks for your time"
i need to make it somthing like
"this is my story, if it's interesting so thanks for your time"
"[email protected]"
my code for now is trying to count Down from the index of the "@" so it is less times to check within the iteration of the for loop
public string formatResultContentAndEmail(string source)
{
char[] Str2CahrArr = source.ToCharArray();
var trgt = source.IndexOf('@');
var stepsBack=0;
for (int i = trgt; i >0; i--)
{
var test = Str2CahrArr[i];
if (Str2CahrArr[i].Equals(" "))
{
stepsBack = i; break;
}
}
return "";//<======change this when done tests
}
my first problem in that try was i couldn't find when it hits a space .
but even when i'll solve that problem, is that approach is the right one ?
what is the simplest way to extract the mail substring of that complete paragraph ?