I posted a question over here: Selecting a substring from a string in C# and I got a nice suggestion of using following code:
int index = String2.IndexOf(String1);
if(index >= 0)
{
string result = String1;
if (String1.Length < String2.Length)
{
string rest = String2.Substring(index + String1.Length);
var chars = rest.TakeWhile(c => !Char.IsLetter(c) && !Char.IsWhiteSpace(c));
result = result + string.Join("", chars);
}
}
I used it in .Net 4.0 and it's working fine. The problem is that I have to use .Net 3.0. Is there any way I can use String.Join in .NET 3.0 or .NET 3.5?
System.Joinexist since .NET Framework 2.0 as far as I know. What is the values ofString2andString1? What is your output and what do you expect?