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

  • Home
  • SEARCH
  • 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 8542939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:11:13+00:00 2026-06-11T12:11:13+00:00

I have a string EMP1$0,EMP2$1,EMP3 $1, Emp4$ 0, emp44$1 ; these are employee codes

  • 0

I have a string “EMP1$0,EMP2$1,EMP3 $1, Emp4$ 0, emp44$1”; these are employee codes separated by coma (,). Each employee code is appended with their statuses (i.e. 1 for active and 0 for inactive and separated with $ sign). Employee code will not contain spaces, but space can be possible between employee code and $. I need to check if an employee code say “EMP4” is present in this string. Which will be best approach?

Any help is highly appreciable.

Edit:

var strResult = from string str in hdnEmpCodes.Value.Split(',') 
                where str.Length > 0 && str.Substring(0, str.IndexOf("$")).Trim() == lnkEmpCode.Text.Trim() 
                select str.ToString(); 

But it is not giving the desired output.

  • 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-11T12:11:15+00:00Added an answer on June 11, 2026 at 12:11 pm

    If you start with the following:

    var text = "EMP1$0,EMP2$1,EMP3 $1, Emp4$ 0, emp44$1";
    

    Then you can perform this query to extract the “EMP” codes:

    var query =
        from x in text.Split(',').Select(_ => _.Trim())
        let y = x.Split('$').Select(_ => _.Trim())
        where y.Any()
        select y.First();
    

    This would give the following result:

    EMP query result

    It would now be a simple matter of checking if any of the returned values match.

    var found = query.Any(x => x.ToUpperInvariant() == "EMP4");
    

    Does this do what you need?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have string which is of format: ;1=2011-10-23T16:16:53+0530;2=2011-10-23T16:16:53+0530;3=2011-10-23T16:16:53+0530;4=2011-10-23T16:16:53+0530; I have written following code to
I have string separated by dot ('.') characters that represents a hierarchy: string source
I have string in the following format. Option1:Option2:Option3:Option4 I want to get these items
I have string which contains every word separated by comma. I want to split
I have string: new y,[[new york,0,[]],[new york times,0,[] I want these string betwent [
I have string that look like Array that fetched from other webservice like this
I have string that displays UTF-8 encoded characters, and I want to convert it
I have string as abvd.qweqw.sdfs.a=aqwrwewrwerrew . I need to parse this string and get
I have string. I then split the string to make an array. I use
I have string like this : <input name=my_name id=my_id value=my_value class=my_class /> I would

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.