In this exercise you will implement a partial set of utility routines to help a developer clean up identifier names.
In the 5 tasks you will gradually build up the function clean.
A valid identifier comprises zero or more letters and underscores.
In all cases the input string is guaranteed to be non-nil. If an empty string is passed to the function, an empty string should be returned.
Note that the caller should avoid calling the function with an empty identifier since such identifiers are ineffectual.
Implement the clean function to replace any spaces with underscores.
This also applies to leading and trailing spaces.
(clean "my Id")
;;=> "my___Id"Modify the clean function to replace control characters with
the upper case string "CTRL".
A character is considered to be an ISO control character if
its code is in the range '\u0000' through '\u001F'
or in the range '\u007F' through '\u009F'.
(clean "my\u007FId")
;;=> "myCTRLId"Modify the clean function to convert kebab-case to camelCase.
(clean "à-ḃç")
;;=> "àḂç"Modify the clean function to omit any characters that are not letters.
Note: The underscores must be preserved from the previous step.
(clean "1😀2😀3😀")
;; => ""Modify the clean function to omit any Greek letters in the range 'α' to 'ω'.
(clean "MyΟβιεγτFinder")
;;=> "MyΟFinder"In this exercise you will implement a partial set of utility routines to help a developer clean up identifier names.
In the 5 tasks you will gradually build up the function clean.
A valid identifier comprises zero or more letters and underscores.
In all cases the input string is guaranteed to be non-nil. If an empty string is passed to the function, an empty string should be returned.
Note that the caller should avoid calling the function with an empty identifier since such identifiers are ineffectual.
Implement the clean function to replace any spaces with underscores.
This also applies to leading and trailing spaces.
(clean "my Id")
;;=> "my___Id"Modify the clean function to replace control characters with
the upper case string "CTRL".
A character is considered to be an ISO control character if
its code is in the range '\u0000' through '\u001F'
or in the range '\u007F' through '\u009F'.
(clean "my\u007FId")
;;=> "myCTRLId"Modify the clean function to convert kebab-case to camelCase.
(clean "à-ḃç")
;;=> "àḂç"Modify the clean function to omit any characters that are not letters.
Note: The underscores must be preserved from the previous step.
(clean "1😀2😀3😀")
;; => ""Modify the clean function to omit any Greek letters in the range 'α' to 'ω'.
(clean "MyΟβιεγτFinder")
;;=> "MyΟFinder"