Quantcast
Viewing all articles
Browse latest Browse all 12583

How can i get from a string not only match cases?

publicstaticvoidColorListBox(List<string> data,DrawItemEventArgs e,string word)
       
{
           
int keywords=0;
           
string keyword=null;
           
string url= data[e.Index].Substring(0,5);
           
if(data[e.Index].Contains(word))//"Local KeyWord:"))
           
{
                keywords
= data[e.Index].IndexOf(word);//"Local KeyWord:");
                keyword
= data[e.Index].Substring(keywords, word.Length);
           
}
           
else
           
{
                keywords
= data[e.Index].IndexOf(word);//"Localy KeyWord:");
                keyword
= data[e.Index].Substring(keywords,15);
           
}

The problem in in Form1 when im calling this function:

ColorText.ColorListBox(data, e);

How do I know wich text to add ? ColorText.ColorListBox(data, e, "Local KeyWord"); orColorText.ColorListBox(data, e, "Localy KeyWord"); Since when im running my program it's Localy KeyWord but when im adding a new url it's "Local KeyWord"

I need in Form1 when calling the function to cover all the options. Before I added the variable word I used manual strings "Local KeyWord" and "Localy Keyword" but now I want to do something that each word or words I will enter as word will be used in the function.

The problem is when im running my program the strings in the variable data are "Localy KeyWord:" And when I add a new url while the program is working then in data the strings are "Local KeyWord:"


danieli


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>