Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 10722 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > Search about text ...
Anwarbesa@Yahoo.Com

Search about text

 Code Snippet posted by: Anwarbesa@Yahoo.Com | Posted on: 5/2/2012 | Category: C# Codes | Views: 531 | Status: [Member] | Points: 40 | Alert Moderator   
Ads

Hi.. this is a code written in c#.net for searching about text from a string

There are four text boxes one for entering a string or text from the user, another for the label addressed as (start with), another for the label addressed as (end with).. and the last one for the result.(Note:you should make the property of text box as multi line)

And there is a button for search.. and now you should click the button and write this code:

string[] sentences = textBox1.Text.Split(' ');

string sPattern1 = textBox2.Text.Trim();
string sPattern2 = textBox3.Text.Trim();
textBox4.Text = "";
foreach (string s in sentences)
{
if (sPattern1.Trim().Length > 0 && s.ToUpper().StartsWith(sPattern1.ToUpper()))

textBox4.Text += s + "\r\n";
if (sPattern2.Trim().Length > 0 && s.ToUpper().EndsWith(sPattern2.ToUpper()))

textBox4.Text += s + "\r\n";


I wish this is will be helpful ^_^

Thanks and regards


C is a sea.. and you are the sea of C!

Thanks & Regards
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 10:39:15 PM