Search code examples
rascal

Capitalize a string in rascal


How can I capitalize a string in rascal?

In the documentation of the string library, I can not find any method to capitalize a string.

http://tutor.rascal-mpl.org/Rascal/Rascal.html#/Rascal/Expressions/Values/String/String.html


Solution

  • You should use the toUpperCase function in the String library, detailed here:

    http://tutor.rascal-mpl.org/Rascal/Rascal.html#/Rascal/Libraries/Prelude/String/toUpperCase/toUpperCase.html

    For example:

    rascal>import String;
    ok
    
    rascal>toUpperCase("hEllO WOrlD");
    str: "HELLO WORLD"