28 lines
486 B
Go
28 lines
486 B
Go
package main
|
|
|
|
|
|
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")
|
|
}
|