Question: What can i use to solve this Question? - - allow - builtincameltosnakecaseInstructionsWrite a function that converts a string from camelCase to snake _ case.If

What can i use to solve this Question?--allow-builtincameltosnakecaseInstructionsWrite a function that converts a string from camelCase to snake_case.If the string is empty, return an empty string.If the string is not camelCase, return the string unchanged.If the string is camelCase, return the snake_case version of the string.For this exercise you need to know that camelCase has two different writing alternatives that will be accepted:lowerCamelCaseUpperCamelCaseRules for writing in camelCase:The word does not end on a capitalized letter (CamelCasE).No two capitalized letters shall follow directly each other (CamelCAse).Numbers or punctuation are not allowed in the word anywhere (camelCase1).Expected functionfunc CamelToSnakeCase(s string) string{}UsageHere is a possible program to test your function:package mainimport ("fmt")func main(){fmt.Println(CamelToSnakeCase("HelloWorld"))fmt.Println(CamelToSnakeCase("helloWorld"))fmt.Println(CamelToSnakeCase("camelCase"))fmt.Println(CamelToSnakeCase("CAMELtoSnackCASE"))fmt.Println(CamelToSnakeCase("camelToSnakeCase"))fmt.Println(CamelToSnakeCase("hey2"))}And its output:$ go run .Hello_Worldhello_Worldcamel_CaseCAMELtoSnackCASEcamel_To_Snake_Casehey2
dont use import to solve the question

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!