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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:45:29+00:00 2026-05-15T20:45:29+00:00

Say we have the following string string data= /temp string; If we want to

  • 0

Say we have the following string

string data= "/temp string";

If we want to remove the first character / we can do by a lot of ways such as :

data.Remove(0,1);
data.TrimStart('/');
data.Substring(1);

But, really I don’t know which one has the best algorithm and doing that faster..
Is there a one that is the best or all are the same ?

  • 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-15T20:45:30+00:00Added an answer on May 15, 2026 at 8:45 pm

    The second option really isn’t the same as the others – if the string is “///foo” it will become “foo” instead of “//foo”.

    The first option needs a bit more work to understand than the third – I would view the Substring option as the most common and readable.

    (Obviously each of them as an individual statement won’t do anything useful – you’ll need to assign the result to a variable, possibly data itself.)

    I wouldn’t take performance into consideration here unless it was actually becoming a problem for you – in which case the only way you’d know would be to have test cases, and then it’s easy to just run those test cases for each option and compare the results. I’d expect Substring to probably be the fastest here, simply because Substring always ends up creating a string from a single chunk of the original input, whereas Remove has to at least potentially glue together a start chunk and an end chunk.

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

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The strategy it to split your application to a different… May 16, 2026 at 5:06 pm
  • Editorial Team
    Editorial Team added an answer table { border-collapse:collapse; } May 16, 2026 at 5:06 pm
  • Editorial Team
    Editorial Team added an answer typedef multimap<string,Employee*> m_employees; Makes m_employees an alias for the specialized… May 16, 2026 at 5:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have following data (String): Course1: A1 Course1: A2 Course2: B1 Course2: B2 Course2:
guys. Say I have the following table: ID | String ---+--------- 1 | <123><345>
Let's say I have the following data in a decimal (18,9) identity column in
Say for example I have the following string one two(three) (three) four five and
Lets say I have the following code public static string GetXMLValue() { XDocument settingsFile
Let's say I have the following two classes: public class Person { public string
My simplified and contrived example is the following:- Lets say that I want to
Let's say I have the following tables my_profile_data ------------- integer: my_profile_data_id integer: profile_id integer:
Lets say we have a following table with two columns and following rows of
Say I have the following JS: var foo_index = 123; var bar_index = 456;

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.