📜

To Lowercase

To Lowercase - Explanation

입문 문자열 O(n) O(n)

Problem Summary

Write a function that converts a string to lowercase.

Go to Problem →

Detailed Explanation

이 문제는 **toLowerCase() 메서드**를 사용하여 문자열을 소문자로 변환하는 방법을 학습합니다. ## 핵심 개념: 소문자 변환 toLowerCase()는 문자열의 모든 대문자를 소문자로 변환합니다. ### 기본 사용법 ```javascript str.toLowerCase() ``` - 원본 문자열은 변경되지 않습니다 - 새로운 소문자 문자열을 반환합니다 ### toUpperCase와 비교 ```javascript const str = "Hello World"; str.toUpperCase() // "HELLO WORLD" str.toLowerCase() // "hello world" str // "Hello World" (원본 유지) ``` ### 실무 활용 - 이메일 주소 정규화 - URL 슬러그 생성 - 검색 기능 (대소문자 무시) - 사용자명 처리 ### 조건부 변환 첫 글자만 소문자로: ```javascript str.charAt(0).toLowerCase() + str.slice(1) ``` 프로그래밍에서 소문자 변환은 데이터 정규화와 비교에 매우 자주 사용됩니다.

Solution Code

solution.js
function toLower(str) {
  return str.toLowerCase();
}

Key Concepts from This Problem

1. toLowerCase 메서드
2. 소문자 변환
3. 문자열 정규화
4. 데이터 비교

Common Mistakes

toLowerCase()도 원본을 변경하지 않습니다
숫자와 특수문자는 그대로 유지됩니다
한글 등 대소문자 개념이 없는 문자는 변환되지 않습니다

Hints

Hint 1: toLowerCase 메서드를 사용하세요.

Complexity Analysis

Time Complexity

O(n)

Grows linearly with input size

Space Complexity

O(n)

Uses memory proportional to input size

Related Tags

#문자열 #toLowerCase #변환