FilterableExamplesFree
slice()Extracts part of string by indexExtract
"hello".slice(1,3) // "el"substring()Like slice but no negative indicesExtract
"hello".substring(0,3) // "hel"split()Splits string into arrayTransform
"a,b,c".split(",") // ["a","b","c"]replace()Replaces first matchTransform
"foo bar".replace("foo","baz") // "baz bar"replaceAll()Replaces all matchesTransform
"aaa".replaceAll("a","b") // "bbb"trim()Removes whitespace from both endsTransform
" hi ".trim() // "hi"trimStart()Removes whitespace from startTransform
" hi".trimStart() // "hi"trimEnd()Removes whitespace from endTransform
"hi ".trimEnd() // "hi"toUpperCase()Converts to uppercaseCase
"hello".toUpperCase() // "HELLO"toLowerCase()Converts to lowercaseCase
"HELLO".toLowerCase() // "hello"charAt()Returns char at indexSearch
"hello".charAt(0) // "h"charCodeAt()Returns UTF-16 code at indexSearch
"A".charCodeAt(0) // 65indexOf()Returns index of first matchSearch
"hello".indexOf("l") // 2lastIndexOf()Returns index of last matchSearch
"hello".lastIndexOf("l") // 3includes()Checks if string contains substringSearch
"hello".includes("ell") // truestartsWith()Checks if starts with substringSearch
"hello".startsWith("he") // trueendsWith()Checks if ends with substringSearch
"hello".endsWith("lo") // truematch()Matches against regexRegex
"abc123".match(/\d+/) // ["123"]matchAll()Returns all regex matchesRegex
"aAbB".matchAll(/[a-z]/g)search()Returns index of regex matchRegex
"abc123".search(/\d/) // 3repeat()Repeats string N timesTransform
"ab".repeat(3) // "ababab"padStart()Pads start to target lengthTransform
"5".padStart(3,"0") // "005"padEnd()Pads end to target lengthTransform
"5".padEnd(3,"0") // "500"concat()Concatenates stringsTransform
"hi".concat(" ","there") // "hi there"at()Returns char at index (supports negative)Search
"hello".at(-1) // "o"Love this tool? Explore 999+ more
Free online tools for images, PDFs, text, code, and more. All running in your browser.
Explore All Tools