Java 字符串转换为小写示例。

java 8object oriented programmingprogramming

String 类的 toLowerCase() 方法有两种变体。第一种变体使用给定 Locale 的规则将此字符串中的所有字符转换为小写。这相当于调用 toLowerCase(Locale.getDefault())。

第二种变体接受一个语言环境作为参数,用于转换为小写。

示例

import java.io.*;
public class Test {
   public static void main(String args[]) {
      String Str = new String("Welcome to Tutorialspoint.com");
      System.out.print("Return Value :");
      System.out.println(Str.toLowerCase());
   }
}

输出

Return Value :welcome to tutorialspoint.com

相关文章