In this exercise you will implement a partial set of utility routines to help a developer clean up identifier names.
In the 6 tasks you will gradually build up the functions transform to convert single characters and clean to convert strings.
A valid identifier comprises zero or more letters, underscores, hyphens, question marks and emojis.
If an empty string is passed to the clean function, an empty string should be returned.
Implement the transform function to replace any hyphens with underscores.
julia> transform('-')
"_"Remove all whitespace characters. This will include leading and trailing whitespace.
julia> transform(' ')
""Modify the transform function to convert camelCase to kebab-case
julia> transform('D')
"-d"Modify the transform function to omit any characters that are numeric.
julia> transform('7')
""Modify the transform function to replace any Greek letters in the range 'α' to 'ω'.
julia> transform('β')
"?"Implement the clean function to apply these operations to an entire string.
Characters which fall outside the rules should pass through unchanged.
julia> clean(" a2b Cd-ω😀 ")
"ab-cd_?😀"In this exercise you will implement a partial set of utility routines to help a developer clean up identifier names.
In the 6 tasks you will gradually build up the functions transform to convert single characters and clean to convert strings.
A valid identifier comprises zero or more letters, underscores, hyphens, question marks and emojis.
If an empty string is passed to the clean function, an empty string should be returned.
Implement the transform function to replace any hyphens with underscores.
julia> transform('-')
"_"Remove all whitespace characters. This will include leading and trailing whitespace.
julia> transform(' ')
""Modify the transform function to convert camelCase to kebab-case
julia> transform('D')
"-d"Modify the transform function to omit any characters that are numeric.
julia> transform('7')
""Modify the transform function to replace any Greek letters in the range 'α' to 'ω'.
julia> transform('β')
"?"Implement the clean function to apply these operations to an entire string.
Characters which fall outside the rules should pass through unchanged.
julia> clean(" a2b Cd-ω😀 ")
"ab-cd_?😀"