Question

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

Was it helpful?

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"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top