In this exercise you will implement a partial set of utility functions to help a developer clean up identifier names.
In the 5 tasks you will gradually build up the clean function.
A valid identifier comprises zero or more letters and underscores.
If an empty string is passed to the clean function, an empty string should be returned.
Implement a clean1 function to replace any spaces with underscores. This also applies to leading and trailing spaces.
clean1 "my Id"
--> "my___Id"Implement clean2 to do everything the previous function does and replace common control characters (\n, \t, and \r ) with the string "[CTRL]".
clean2 "my\nId"
--> "my[CTRL]Id",Implement clean3 to do everything the previous function does and convert kebab-case to camelCase.
clean3 "à-ḃç"
--> "àḂç"Implement 'clean4` to do everything the previous function does and omit all digits.
clean4 "123"
--> ""Finally, implement clean to do everything the previous function does and omit any Greek letters in the range 'α' to 'ω'.
clean "My Οβιεγτ Finder"
--> "My_Ο_Finder"In this exercise you will implement a partial set of utility functions to help a developer clean up identifier names.
In the 5 tasks you will gradually build up the clean function.
A valid identifier comprises zero or more letters and underscores.
If an empty string is passed to the clean function, an empty string should be returned.
Implement a clean1 function to replace any spaces with underscores. This also applies to leading and trailing spaces.
clean1 "my Id"
--> "my___Id"Implement clean2 to do everything the previous function does and replace common control characters (\n, \t, and \r ) with the string "[CTRL]".
clean2 "my\nId"
--> "my[CTRL]Id",Implement clean3 to do everything the previous function does and convert kebab-case to camelCase.
clean3 "à-ḃç"
--> "àḂç"Implement 'clean4` to do everything the previous function does and omit all digits.
clean4 "123"
--> ""Finally, implement clean to do everything the previous function does and omit any Greek letters in the range 'α' to 'ω'.
clean "My Οβιεγτ Finder"
--> "My_Ο_Finder"