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 7619771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:46:19+00:00 2026-05-31T03:46:19+00:00

Okay so my code looks kinda like this // Returns the note of a

  • 0

Okay so my code looks kinda like this

        // Returns the note of a favorite pown if it exists
        string GetFavoriteNote(int id)
        {
            string notelist = Properties.Settings.Default.FavoriteNotesList;

            // If there's a note, return it
            if (notelist.Contains("'" + id + ":"))
            {
                // What to do here?
            }
            // If there's no note, return an empty string
            else
            {
                return String.Empty;
            }
        }

Now it’s basically a system where for each id the user can set a note, and it will be saved in this format: 'id:note','id:note',

Now what I want to do is select that note somehow and return it, so I’d have to like select from "'" + id + ":" until the ‘

If anyone knows how to do this, please help me out.
Thanks

  • 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-05-31T03:46:20+00:00Added an answer on May 31, 2026 at 3:46 am

    Using a Regex seems like the cleanest approach to me:

    string regexFormat = "'{0}:(.*?)'";
    Match match = Regex.Match(notelist, string.Format(regexFormat, id));
    return match.Success ? match.Groups[1].Value : string.Empty;
    

    Alternatively however, you could use string splitting:

    var notes = notelist.Split(',');
    var idString = "'" + id + ":";
    var note = notes.FirstOrDefault(n => n.StartsWith(idString));
    if (note == null) return string.Empty;
    return note.Substring(idString.Length, note.Length - (idString.Length + 1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I'm not using any session variables, rather my code looks like this:
I'm sending GET request (which returns JSON). The code looks like: $.ajax({ url: http://www.new.marketprice.ru/retrieveRegions.html,
I am using python 2.7, I have some code that looks like this: task1()
My code looks like this #define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end();
Okay I have something that looks like this: Company Name-1234 I only want the
Okay i am working on someone elses code. They do alot of this: char
Okay so I have the following Code which appends a string to another in
Okay, I have this code: <script language=javascript type=text/javascript> <!-- function requestPage(page) { var request
Okay, so i have this code i wrote: class Connection { public static StreamWriter
Okay so, I'm currently running this code to move a bunch of data from

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.