add a function to convert from kebab case (expectation for file names) to pascal case (convention used for structures)
This commit is contained in:
@@ -1,5 +1,27 @@
|
||||
structure CollisionTree =
|
||||
struct
|
||||
local
|
||||
fun finish acc =
|
||||
let val acc = List.rev acc
|
||||
in String.implode acc
|
||||
end
|
||||
|
||||
fun loop (#"-" :: chr :: tl, acc) =
|
||||
let val acc = Char.toUpper chr :: acc
|
||||
in loop (tl, acc)
|
||||
end
|
||||
| loop ([#"-"], acc) = finish acc
|
||||
| loop (chr :: tl, acc) =
|
||||
loop (tl, chr :: acc)
|
||||
| loop ([], acc) = finish acc
|
||||
in
|
||||
fun kebabCaseToPascalCase str =
|
||||
(* capitalise first character in string *)
|
||||
case String.explode str of
|
||||
chr :: tl => let val chr = Char.toUpper chr in loop (tl, [chr]) end
|
||||
| [] => ""
|
||||
end
|
||||
|
||||
structure BinTree =
|
||||
struct
|
||||
datatype 'a bintree =
|
||||
|
||||
Reference in New Issue
Block a user