Search character from a string
-
I am writing a search mechanism in asp.net. User enters the keywords, from the result string, i look for the index of keyword entered by user and showing results onwards. I want my code to look for space character such that i users enters 'ruth' my code gets the index of ruth and showing results. i want it to look for space before keyword so that complete word can be showed e.g 'truth'. Thanks in Advance
-
I am writing a search mechanism in asp.net. User enters the keywords, from the result string, i look for the index of keyword entered by user and showing results onwards. I want my code to look for space character such that i users enters 'ruth' my code gets the index of ruth and showing results. i want it to look for space before keyword so that complete word can be showed e.g 'truth'. Thanks in Advance
You can use RegularExpresion[^]: e.g
string MainString="Truth is good";
MatchCollection mc = Regex.Matches(MainString,@"\wruth");
if(mc.Count>0)
{
string result = mc[0].Value;
}Hope this will help you.
I Love T-SQL "VB.NET is developed with C#.NET" If my post helps you kindly save my time by voting my post. www.cacttus.com