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
// https://edabit.com/challenge/Mc6Xi4PRw7fDzeMDB | |
// Create a function that takes a string and returns a string in which each character is repeated once. | |
// Examples | |
// doubleChar("String") ➞ "SSttrriinngg" | |
// doubleChar("Hello World!") ➞ "HHeelllloo WWoorrlldd!!" |
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
// Hiding the Card Number | |
// Write a function that takes a credit card number and only displays the last four characters. | |
// The rest of the card number must be replaced by ************. | |
// Examples | |
// cardHide("1234123456785678") ➞ "************5678" | |
// cardHide("8754456321113213") ➞ "************3213" |
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
// Move Capital Letters to the Front | |
// Create a function that moves all capital letters to the front of a word. | |
// Examples | |
// capToFront("hApPy") ➞ "APhpy" | |
// capToFront("moveMENT") ➞ "MENTmove" |
NewerOlder