Simply replace it with nothing:

var string = 'F0123456'; // just an example
string.replace(/^F0+/i, ''); '123456'
Answer from Mathias Bynens on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-remove-a-character-from-string-in-javascript
Remove a Character From String in JavaScript - GeeksforGeeks
February 25, 2026 - Below are the following methods by which we can remove the character from a string: One of the most common methods to remove a character from a string is by using the replace() method.
Discussions

How can I remove a character from a string using JavaScript? - Stack Overflow
Usually I program in C# (Sharp), and whenever I want to remove characters from string, I use the Remove method of the String class, but no Replace method, even though it exists, because when I am about to remove, I remove, no replace. This is logical! In Javascript, there is no remove function ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Remove character from string using javascript - Stack Overflow
i have comma separated string like var test = 1,3,4,5,6, i want to remove particular character from this string using java script can anyone suggests me? More on stackoverflow.com
๐ŸŒ stackoverflow.com
August 1, 2016
Removing rest of string after a certain character
gsub("\\(.*", "", my_string) should work. \\( matches the '(' character (the backslashes are to escape it, since '(' is a special character in regular expressions), .* matches everything after it. More on reddit.com
๐ŸŒ r/rstats
4
3
June 3, 2021
How to remove part of string after certain character in python?

There are a few ways. Here are a few off the top of my head:

>>> s = "abcd//efgh"

>>> s.find("/")
4
>>> s[:s.find("/")]
'abcd'

>>> s.split("/")
['abcd', '', 'efgh']
>>> s.split("/", maxsplit=1)
['abcd', '/efgh']
>>> s.split("/", maxsplit=1)[0]
'abcd'

>>> import re
>>> re.sub("/.*$", "", s)
'abcd'

The last is overkill here and I wouldn't use it, but regexs are often appropriate for doing search & replace operations. Either of the first two would work pretty well. The first depends on the search string appearing though. Otherwise, s.find will return -1 and then s[:-1] will lop off the last character:

>>> s = "abcdef"
>>> s[:s.find("/")]
'abcde'
More on reddit.com
๐ŸŒ r/AskProgramming
4
5
July 2, 2017
People also ask

What is the most efficient method to remove a character from a string in JavaScript?
The efficiency of a method can vary depending on the context and the specific requirements of your task. However, the replace() method is often recognized for its efficacy and versatility in string replacement tasks.
๐ŸŒ
tracedynamics.com
tracedynamics.com โ€บ javascript-remove-character-from-string
11 Ways to Remove Character from String in JavaScript
How do I remove all instances of a specific character from a string?
Methods like replace() with Regular Expressions, split() and join() combination, or utilizing external libraries like Lodash are excellent choices for removing all instances of a specified character from a string.
๐ŸŒ
tracedynamics.com
tracedynamics.com โ€บ javascript-remove-character-from-string
11 Ways to Remove Character from String in JavaScript
When should I choose to use a custom function for character removal?
Custom functions come in handy when the built-in methods do not cater to your specific needs or when you have a unique logic for character removal. They provide the flexibility to design a character removal strategy tailored to your requirements.
๐ŸŒ
tracedynamics.com
tracedynamics.com โ€บ javascript-remove-character-from-string
11 Ways to Remove Character from String in JavaScript
๐ŸŒ
CoreUI
coreui.io โ€บ answers โ€บ how-to-remove-special-characters-from-a-string-in-javascript
How to remove special characters from a string in JavaScript ยท CoreUI
May 20, 2026 - This approach provides precise control over which characters to remove and handles complex filtering scenarios efficiently. Use replace() with a regular expression to remove special characters from a string.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-remove-characters-from-a-string-in-javascript
How to remove characters from a string in JavaScript
JavaScript provides several built-in methods for removing characters from strings, each with unique functionalities: replace(): Replaces specified characters with a new string or removes them when an empty string is used.
๐ŸŒ
Stackademic
blog.stackademic.com โ€บ javascript-how-to-remove-a-character-from-a-string-398e81f13617
JavaScript: How to Remove a Character From a String | by Alex Zelinsky | Stackademic
September 23, 2024 - ๐Ÿ’ก Learn how to check for an empty object in JavaScript: ... The replace() method is one of the most straightforward ways to remove a character from a string. It searches a string for a specified value, or a regular expression, and returns ...
Find elsewhere
๐ŸŒ
Envato Tuts+
code.tutsplus.com โ€บ home โ€บ coding fundamentals
How to Remove a Character From a String in JavaScript | Envato Tuts+
June 26, 2021 - So thatโ€™s how you can use the replace method with a regular expression to remove all occurrences of a specific character from the source string. In this last section, weโ€™ll see how you can use the split method to remove a character from ...
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ how to remove a character from string in javascript?
How to Remove a Character from String in JavaScript? - Scaler Topics
June 28, 2022 - To remove a character from a string in Javascript, you can use the replace() function, slice() method, or string substr() function. Let's deep-dive into the methods.
๐ŸŒ
TraceDynamics
tracedynamics.com โ€บ javascript-remove-character-from-string
11 Ways to Remove Character from String in JavaScript
January 9, 2024 - The JavaScript substring() method retrieves characters between two indexes, returning a new substring. By setting startindex and endindex, you can effectively remove characters. For instance, to remove first character from a string, you can ...
๐ŸŒ
Appdividend
appdividend.com โ€บ javascript-remove-character-from-string
How to Remove a Character from String in JavaScript
August 6, 2025 - To remove the specific character from a JavaScript String, use the replace() method. It replaces that character with an empty character, making it look like the character is deleted.
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ javascript-remove-special-characters-from-string
Remove special Characters from a String in JavaScript | bobbyhadz
We used the g (global) flag to match all occurrences of the regex in the string and not just the first occurrence. The square brackets [] part denotes a character class and the caret ^ symbol means "not the following characters". ... In its entirety, the regular expression matches all characters but lowercase and uppercase letters, digits and spaces. If you need to exclude other characters from being matched, add them between the square brackets [] of the regular expression. If you don't know the syntax for a specific character, check out the MDN regex syntax cheat sheet.
๐ŸŒ
MSR
rajamsr.com โ€บ home โ€บ javascript remove character from string: 11 easy ways
JavaScript Remove Character from String: 11 Easy Ways | MSR - Web Dev Simplified
February 24, 2024 - Alternatively, you can use the JavaScript split() method to remove a string after a specific character.
๐ŸŒ
Stackademic
stackademic.com โ€บ blog โ€บ javascript-how-to-remove-a-character-from-a-string
JavaScript: How to Remove a Character From a String | Stackademic
August 29, 2023 - ๐Ÿ’ก Learn how to check for an empty object in JavaScript ยท The replace() method is one of the most straightforward ways to remove a character from a string. It searches a string for a specified value, or a regular expression, and returns a ...
๐ŸŒ
CodexWorld
codexworld.com โ€บ home โ€บ how to guides โ€บ how to trim a specific character from the start and end of a string using javascript?
How to Trim a Specific Character from the Start and End of a String using JavaScript? - CodexWorld
April 14, 2021 - Regular Expression (RegEx) is the easiest way to trim a specific character from a string in JavaScript. Use the JavaScript replace() method with RegEx to remove a specific character from the string.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ how-to-remove-text-from-a-string-in-javascript
JavaScript โ€“ Remove Text From a String | GeeksforGeeks
November 16, 2024 - The replace() method is a direct and widely used method to remove specific text by replacing it with an empty string "". This method becomes more powerful with regular expressions for multiple or case-insensitive replacements.
๐ŸŒ
Linux Hint
linuxhint.com โ€บ remove-characters-strings-js
Linux Hint โ€“ Linux Hint
October 6, 2021 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
๐ŸŒ
W3Resource
w3resource.com โ€บ javascript-exercises โ€บ javascript-basic-exercise-22.php
JavaScript basic: Remove a character at the specified position of a given string and return the new string - w3resource
June 30, 2025 - This JavaScript program removes a character at a specified position in a given string and returns the modified string. It takes the position as input and removes the character at that position using string manipulation methods like substring() or slice().