From a4cc00555917adf855547e1744d49df3f21ed7ca Mon Sep 17 00:00:00 2001 From: "a.pivkin" Date: Wed, 10 Sep 2025 06:35:33 +0300 Subject: [PATCH] updated bookmarks in chrome --- codewars/main.go | 26 ++++++++++++++++++++++++++ codewars/task.txt | 9 +++++++++ 2 files changed, 35 insertions(+) create mode 100644 codewars/task.txt diff --git a/codewars/main.go b/codewars/main.go index fb98704..a56b494 100644 --- a/codewars/main.go +++ b/codewars/main.go @@ -1,5 +1,6 @@ package main +<<<<<<< Updated upstream import "fmt" func ending(start, end string) bool { @@ -16,4 +17,29 @@ func ending(start, end string) bool { func main() { ending("abc","bc") ending("abc","d") +======= +import ( + "fmt" + "strings" +) + + +func ToCamelCase(s string) string { + // your code + dash := "-" + // und := "_" + if strings.Contains(s,dash) { + fmt.Println("Contains dashes!") + index := strings.Index(s,dash) + fmt.Println(index) + fmt.Println(strings.ReplaceAll(s,string(s[index:index]),strings.ToUpper(string(s[index+1])))) + } + return "" +} + +func main() { + ToCamelCase("the-stealth-warrior") + // ToCamelCase("The_Stealth_Warrior") + // ToCamelCase("The_Stealth-Warrior") +>>>>>>> Stashed changes } diff --git a/codewars/task.txt b/codewars/task.txt new file mode 100644 index 0000000..fd5e64c --- /dev/null +++ b/codewars/task.txt @@ -0,0 +1,9 @@ +Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Upper Camel Case, also often referred to as Pascal case). The next words should be always capitalized. + +Examples +"the-stealth-warrior" gets converted to "theStealthWarrior" + +"The_Stealth_Warrior" gets converted to "TheStealthWarrior" + +"The_Stealth-Warrior" gets converted to "TheStealthWarrior" +