codecamp

Groovy toLowerCase()方法

将此字符串中的所有字符转换为小写。

句法

String toLowerCase()

参数

没有

返回值

小写的修改字符串。

下面是一个使用这个方法的例子 -

class Example { 
   static void main(String[] args) { 
      String a = "HelloWorld"; 
      println(a.toLowerCase()); 
   } 
}

当我们运行上面的程序,我们将得到以下结果 -

helloworld
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定