Fastest way to remove first char in a String

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(“https://stackoverflow.com/”); 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 … Read more

How to trim a string to N chars in Javascript?

How can I, using Javascript, make a function that will trim string passed as argument, to a specified length, also passed as argument. For example: var string = “this is a string”; var length = 6; var trimmedString = trimFunction(length, string); // trimmedString should be: // “this is” Anyone got ideas? I’ve heard something about … Read more