Normalize line endings in a JavaScript string
Having trouble with inconsistent line endings in your strings? Normalize them with this handy JavaScript function!
The JavaScript article collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Having trouble with inconsistent line endings in your strings? Normalize them with this handy JavaScript function!
Encode and decode strings with Base64 in JavaScript easily with these code snippets.
Avoid the naive approach and use a more robust method to edit URL parameters in JavaScript.
A short guide on how to correctly construct a URL in JavaScript.
Use a regular expression to remove HTML/XML tags from a string.
Test if a string's start or end partially matches another string.
Remove non-printable ASCII characters from a string in JavaScript.
Convert a number in bytes to a human-readable string.
Learn how to work with whitespaces in JavaScript strings, using these simple yet powerful regular expression techniques.
Let's have a look at how to check if a string contains a substring in JavaScript.
Search for substrings in JavaScript strings without worrying about case sensitivity.
Ever wanted to convert a tilde path to an absolute path? Here's how you can do it in JavaScript.
Have you ever tried to convert the string representation of a boolean to an actual boolean value? Here's a simple way to do it.
Replace all characters in a string, except for the ending characters, with a mask character.
Learn how to level up your regular expressions game, with features such as backreferences, lookaheads and named groups.
Use these simple tricks to check if a string is uppercase or lowercase in JavaScript.
Learn how to escape a string to use in a regular expression.
Use special Unicode characters to print text in color in the console.
Learn how to easily convert any string to a SEO-friendly slug, using regular expressions.
Convert tabs to spaces, allowing you to control the number of spaces each tab corresponds to.
Strings in JavaScript can be escaped in various ways. But how do you prevent a string from being escaped? Here's a handy trick for that.
Learn how to pluralize a string in JavaScript based on a number.
Indent each line in a string by a specified number of spaces or a custom indentation character.
Figure out the exact number of bytes in a JavaScript string, including Unicode characters.