【原題目】:

Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.

 

Example 1:

Input: "Hello"
Output: "hello"

Example 2:

Input: "here"
Output: "here"

Example 3:

Input: "LOVELY"
Output: "lovely"

 

參考 :  https://leetcode.com/problems/to-lower-case/

 

【My Solution】:

2.PNG

 

【學習重點】

1. Java 的 String 提供轉大寫及小寫的方法使用

String toLowerCase()
Converts all of the characters in this String to lower case using the rules of the default locale.

 

String toUpperCase()
Converts all of the characters in this String to upper case using the rules of the default locale.
​​​​​​​
arrow
arrow
    創作者介紹
    創作者 Mark Zhang 的頭像
    Mark Zhang

    讀處

    Mark Zhang 發表在 痞客邦 留言(0) 人氣()