Motoko Type Text methods uppercase and lowercase

For the moment you can do this:

import Text "mo:base/Text";
import Prim "mo:prim";

let message = "HeLLo";

let x = Text.map(message , Prim.charToLower);
let y = Text.map(message , Prim.charToUpper);

Note you generally shouldn’t use this Prim import (it’s internal and subject to change) but those functions aren’t yet exposed in the base library, I’m sure they will be soon.

8 Likes