꾸준히 하고싶은 개발자

Is the string uppercase? 본문

모두의연구소/모두연 알고리즘

Is the string uppercase?

프라우스 2023. 12. 10. 15:45

Task

Create a method to see whether the string is ALL CAPS.

Examples (input -> output)

"c" -> False
"C" -> True
"hello I AM DONALD" -> False
"HELLO I AM DONALD" -> True
"ACSKLDFJSgSKLDFJSKLDFJ" -> False
"ACSKLDFJSGSKLDFJSKLDFJ" -> True

In this Kata, a string is said to be in ALL CAPS whenever it does not contain any lowercase letter so any string containing no letters at all is trivially considered to be in ALL CAPS.

이 Kata에서 문자열은 소문자를 포함하지 않을 때마다 모두 대문자로 표시되므로 문자가 전혀 포함되지 않은 문자열은 일반적으로 모두 대문자로 간주됩니다.

          풀이1 if 조건

             삼항연산자

            조건을 toUpperCase는 소문자 → 대문자로 변경하고 toLowerCase는 대문자 → 소문자로 변경 되는 메소드다. 

'모두의연구소 > 모두연 알고리즘' 카테고리의 다른 글

Returning Strings  (0) 2023.12.16
Even Odd  (0) 2023.12.09
코드워즈 Is it a palindrome?  (0) 2023.12.02