Tag Archives — Strings
PHP String Functions (All on One Page)
addcslashes() — Quote string with slashes in a C style addslashes() — Quote string with slashes bin2hex() — Convert binary data into hexadecimal representation chop() — Alias of rtrim chr() — Generate a single-byte string from a number chunk_split() — Split a string into smaller chunks convert_cyr_string() — Convert from one Cyrillic character set to […]
Replace all Occurrences of a String in JavaScript
JavaScript has a lot of useful methods that you can use to manipulate strings. For example, there is a String.replace() method to replace a simple substring with another string. One problem with this method is that it only replaces the first occurrence of the word or substring. In this tutorial, we will learn about different […]
Check if String Contains a Specific Word or Substring in JavaScript
Let’s say you have a string and you want to check if it contains a specific word, character or substring. In this article, you will learn about different ways in which you can perform the check using JavaScript. Here are a few variables that we are going to use: JavaScript var theString = “I have […]
How Can I Strip all Whitespace Characters in a String in PHP?
Many times, the strings that you are manipulating in a PHP project will have extra spaces that need to be removed. For instance, you might want to replace multiple spaces with a single space or you might want to get rid of all the whitespace in a string. Similarly, you might be planning on stripping […]