This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert camelCase to snake_case | |
// Create a function that takes a string of words (or just one word) and converts each word from camelCase to snake_case. | |
// Examples | |
// camelToSnake("magicCarrots") ➞ "magic_carrots" | |
// camelToSnake("greatApples for aSmellyRhino") ➞ "great_apples for a_smelly_rhino" | |
// camelToSnake("thatsGreat") ➞ "thats_great" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From A to Z | |
// Given a string indicating a range of letters, return a string which includes all the letters in that range, | |
// including the last letter.Note that if the range is given in capital letters, return the string in capitals also! | |
// Examples | |
// gimmeTheLetters("a-z") ➞ "abcdefghijklmnopqrstuvwxyz" | |
// gimmeTheLetters("h-o") ➞ "hijklmno" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Split String by Identical Characters | |
// Create a function that splits a string into an array of identical clusters. | |
// Examples | |
// splitGroups("555") ➞ ["555"] | |
// splitGroups("5556667788") ➞ ["555", "666", "77", "88"] | |
// splitGroups("aaabbbaabbab") ➞ ["aaa", "bbb", "aa", "bb", "a", "b"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find the Unique Letters | |
// Create a function that takes a string and returns an array of the letters that occur only once. | |
// findLetters("monopoly") ➞ ["m", "n", "p", "l", "y"] | |
// findLetters("balloon") ➞ ["b", "a", "n"] | |
// findLetters("analysis") ➞ ["n", "l", "y", "i"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replacing Letters with Hashes | |
// Write a function that replaces all letters within a specified range with the hash symbol #. | |
// Examples | |
// replace("abcdef", "c-e") ➞ "ab###f" | |
// replace("rattle", "r-z") ➞ "#a##le" | |
// replace("microscopic", "i-i") ➞ "m#croscop#c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stretched Words | |
// Write a function that takes a string, and returns a new string with any duplicate consecutive letters removed. | |
// Examples | |
// unstretch("ppoeemm") ➞ "poem" | |
// unstretch("wiiiinnnnd") ➞ "wind" | |
// unstretch("ttiiitllleeee") ➞ "title" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Longest Word | |
// Write a function that finds the longest word in a sentence and returns it. | |
// If two or more words are the biggest, return the word closest to the start of the sentence. | |
// Characters such as apostrophe, commas, periods, etc count as letters (e.g.O'Connor is 8 characters long). | |
// Examples | |
// longestWord("Hello darkness my old friend") ➞ "darkness" | |
// longestWord("Hello there mate") ➞ "Hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change Every Letter to the Next Letter | |
// Write a function that changes every letter to the next letter: | |
// "a" becomes "b" | |
// "b" becomes "c" | |
// "d" becomes "e" | |
// and so on ... | |
// move("hello") ➞ "ifmmp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extend the Vowels | |
// Create a function that takes a word and extends all vowels by a number num. | |
// extendVowels("Hello", 5) ➞ "Heeeeeelloooooo" | |
// extendVowels("Edabit", 3) ➞ "EEEEdaaaabiiiit" | |
// extendVowels("Extend", 0) ➞ "Invalid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reverse Words in a String | |
// Given an input string, reverse the string word by word, the first word will be the last, and so on. | |
// Examples | |
// reverseWords(" the sky is blue") ➞ "blue is sky the" | |
// reverseWords("hello world! ") ➞ "world! hello" |
NewerOlder