Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove first 10 characters from a string?

How to ignore the first 10 characters of a string?

Input:

str = "hello world!"; 

Output:

d! 
like image 949
csharper Avatar asked Aug 25 '11 07:08

csharper


People also ask

How do I remove the first 10 characters from a string in Python?

Use Python to Remove the First N Characters from a String Using Regular Expressions. You can use Python's regular expressions to remove the first n characters from a string, using re's . sub() method. This is accomplished by passing in a wildcard character and limiting the substitution to a single substitution.

How do I find the first 10 characters of a string?

How to find the first 10 characters of a string in C#? To get the first 10 characters, use the substring() method. string res = str. Substring(0, 10);


2 Answers

str = str.Remove(0,10); Removes the first 10 characters

or

str = str.Substring(10); Creates a substring starting at the 11th character to the end of the string.

For your purposes they should work identically.

like image 188
crlanglois Avatar answered Sep 28 '22 01:09

crlanglois


str = "hello world!"; str.Substring(10, str.Length-10) 

you will need to perform the length checks else this would throw an error

like image 28
V4Vendetta Avatar answered Sep 28 '22 03:09

V4Vendetta