Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:16:27+00:00 2026-06-10T19:16:27+00:00

In my project I’m having a StringBuilder which takes the selected value of dropdown

  • 0

In my project I’m having a StringBuilder which takes the selected value of dropdown lists.

StringBuilder builder = new StringBuilder();
builder.Append(ddl_model.SelectedValue);
builder.Append(ddl_language.SelectedValue);

foreach (string str in list)
{
    if (str.Contains(builder.ToString()))
    {
        lstpdfList.Items.Add(str);
    }
}

It works with one value. I would like to make that I can check if contains two or more words.

I have a file like PM12_Manual_Rev1_EN . Now I can find if it contains PM12. But there is a lot of them. So I would like to check if contains PM12 + EN.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:16:29+00:00Added an answer on June 10, 2026 at 7:16 pm

    1) Don’t call builder.ToString() inside the foreach, it will rebuild the string everytime, and it defeats the performance purpose of StringBuilder.

    2) Don’t use a StringBuilder, use a List in which you store the words you want to match for, if each selected value may contain several words, split them:

    var keywords = new List<string>();
    keywords.AddRange(ddl_model.SelectedValue.Split(' '));
    keywords.AddRange(ddl_language.SelectedValue.Split(' '));
    
    foreach(string str in list)
       if (keywords.Any(keyword => str.Contains(keyword))
          lstpdfList.Items.Add(str);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My project is currently using a svn repository which gains several hundred new revisions
Project hasMany Comments Payment (id, project_id, value, date) I want to include in my
Our project's template html has a quirks declaration,which is <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML
Project : Game in Flex builder 4 (Actionscript Project) Language : Actionscript 3 This
Project: ASP.NET 3.5 with C# I have this much :- A table which used
Project: I am having a button that toggles the column length from 3 to
Project Description: I have to make an application in android which gets the Latitude
Project I've developed a remoting class which is used to replace a subset of
Project: http://design.vitalbmx.com/fave/news.html When I click Add to favorites button (under main pic), in Chrome
Project layout: /project_a /shared /project_b /shared /shared project_a and project_b both need to contain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.