【原題目】:

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 發表在 痞客邦 留言(0) 人氣()