slice(시작index, 끝index)
원본 문자열을 수정하지 않으며, 문자열 일부를 추출하여 새로운 문자열로 반환한다.
const str = 'apple thx sorry'
str.slice(8) // x sorry
str.slice(2, 4) // ple
split(separator, limit)
separator : 끊어야 할 부분을 나타내는 문자열
limit : 끊어진 문자열의 최대 개수
문자열을 구분자 기준으로 나누어 배열로 변환한다.
const str = 'Oh brave new world that has such people in it.'
str.split(" ", 3) // ['Oh', 'brave', 'new']
const str2 = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'
str2.split(",")
// ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
startsWith(searchString, position)
어떤 문자로 시작하는지 확인하여 true, false를 반환한다.
const str = 'start'
str.startWith('st') // true
str.startWith('st', 3) // false
substring(시작index, 끝index)
끝index는 포함하지 않음.
const str = 'world'
str.substring(1, 4) // orl
toLowerCase(), toUpperCase()
Lower : 소문자로 반환.
Upper : 대문자로 반환.
toLocaleLowerCase(locales), toLocaleUpperCase(locales)
locales
"hi": 힌두어(언어)
"de-AT": 오스트리아(지역)에서 사용하는 독일어(언어)
"zh-Hans-CN": 중국(지역)에서 사용하는 간체(스크립트)로 쓰인 중국어(언어)
"en-emodeng": "초기 현대 영어" 방언(변형)의 영어(언어)