Camel case and snake case: Difference between revisions

m
spacing
(new task)
m (spacing)
Line 4:
'''Camel Case'''.
 
'''Snake case''' variables are generally all lower case, with an underscore between words in the variable, as in '''snake_case_variable''''. '''Camel case''' variables are generally lower case first (except in some Pascal conventions or with class names in many other languages), with an underscore between words in the variable, as in ''''snakeCaseVariable''''.
variable, as in '''snake_case_variable''''. '''Camel case''' variables are generally lower case first
(except in some Pascal conventions or with class names in many other languages), with an
underscore between words in the variable, as in ''''snakeCaseVariable''''.
 
Leading underscores are not used in such variables except as part of a different naming convention, usually for special internal or system variables. White space is not permitted as part of camel case or snake case variable names.
convention, usually for special internal or system variables. White space is not permitted
as part of camel case or snake case variable names.
 
;Task:
 
:* Write two functions, one to change snake case to camel case and one to change camel case to snake case. If possible, generalize the function enough to apply to strings containing spaces between words or a `-` dash between words, assuming that iin those cases a space or
hyphen is a also a separator character, like `_`, for the purpose of creating a new varable name. Leading or trailing whitespace may be ignored.
snake case. If possible, generalize the function enough to apply to strings containing
spaces between words or a `-` dash between words, assuming that iin those cases a space or
hyphen is a also a separator character, like `_`, for the purpose of creating a new varable
name. Leading or trailing whitespace may be ignored.
 
:*Show the results on changing to both snake case and camel case for each of the following strings:
4,102

edits