String Programs
The following programs (or tutorials) cover different topics related to strings in JavaScript.
Create
- Create string with single quotes in JavaScript
- Create string with double quotes in JavaScript
- Create multiline string in JavaScript
- Create empty string in JavaScript
Access
- Access character in a string using square brackets in JavaScript
- Get first character from string in JavaScript
- Get last character from string in JavaScript
- Get character at specific index from string in JavaScript
- Iterate over characters of string in JavaScript
- Length of a string in JavaScript
- Print string to console output
Find
- – Find all indices of occurrences of substring in string in JavaScript
- – Find all substrings that match given regular expression in string in JavaScript
- – Find index of first occurrence of substring in string in JavaScript
- – Find index of last occurrence of substring in string in JavaScript
- – Find number of occurrences of substring in a string in JavaScript
- – Find number of words in a string in JavaScript
- – Find substring of a string in JavaScript
- – Get all the numbers in the string as an array in JavaScript
Convert
- Convert first character of string to uppercase in JavaScript
- Convert array of characters to string in JavaScript
- Convert CSV string to array in JavaScript
- Convert array to CSV string in JavaScript
- Convert string to lowercase in JavaScript
- Convert string to uppercase in JavaScript
- Convert string to number in JavaScript
- Convert number to string in JavaScript
Checks
- Check if string contains specific character in JavaScript
- Check if string contains specific substring in JavaScript
- Check if string contains only alphabets in JavaScript
- Check if string contains only alphanumeric in JavaScript
- Check if string contains only numeric in JavaScript
- Check if string contains only lowercase in JavaScript
- Check if string contains only uppercase in JavaScript
- Check if string ends with specific suffix string in JavaScript
- Check if string ends with forward slash in JavaScript
- Check if string matches given regular expression in JavaScript
- Check if string starts with specific prefix string in JavaScript
- Check if string starts with digit in JavaScript
- Check if string starts with lowercase character in JavaScript
- Check if string starts with uppercase character in JavaScript
- Check if string is empty in JavaScript
- Check if two strings are equal in JavaScript
- Check if two strings are equal ignoring case in JavaScript
- Check if URL string starts with ‘http’ in JavaScript
Update / Transform
- – Concatenate two string in JavaScript
- – Concatenate string and number in JavaScript
- – Insert character at specific index in string in JavaScript
- – Join strings in array by given separator string in JavaScript
- Repeat string N times in JavaScript
- Replace all occurrences of a substring in a string in JavaScript
- Replace all occurrences of a specific character in a string in JavaScript
- – Replace all substrings that match given regular expression in string in JavaScript
- Replace a specific character in a string in JavaScript
- – Replace first occurrence of substring in JavaScript
- – Replace last occurrence of substring in JavaScript
- Reverse a string in JavaScript
- slice() vs substring() in JavaScript
- Sort characters in a string in ascending order in JavaScript
- Sort characters in a string in descending order in JavaScript
- Split string by comma in JavaScript
- Split string by new line in JavaScript
- – Split string by space in JavaScript
- – Split string by a delimiter string in JavaScript
- Split string into array of characters in JavaScript
- Trim string in JavaScript
Delete
- Remove first character from string in JavaScript
- Remove last character from string in JavaScript
- Remove character at specific index from string in JavaScript
- Remove all occurrences of a specific character from a string in JavaScript