updated bookmarks in chrome

This commit is contained in:
a.pivkin 2025-09-10 06:35:33 +03:00
parent 44bc223d18
commit a4cc005559
2 changed files with 35 additions and 0 deletions

View File

@ -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
}

9
codewars/task.txt Normal file
View File

@ -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"