# 문자열

## String

```javascript
let str = new String("Hello");
```

```javascript
charAt()
charCodeAt()
codePointAt()
indexOf()
lastIndexOf()
startsWith()
endsWith()
includes()
concat()
fromCharCode()
fromCodePoint()
split()
slice()
substring()
substr()
match(regexp)
replace(regexp)
search(regexp)
toLowerCae()
toUpperCase()
normalize()
repeat()
trim()
```

## 국제화; Intl

### DateTimeFormat

```javascript
const FORMAT = new Intl.DateTimeFormat("ko-KR", {
    year: "numeric", month: "2-digit", day: "2-digit",
    hour: "2-digit", minute: "2-digit", second: "2-digit",
    timeZoneName: "long"
});

let now = new Date();
console.log(FORMAT.format(now));
```

#### 매개변수 옵션

- dateStyle

    - full
    - long
    - medium
    - short
- timeStyle

    - full
    - long
    - medium
    - short
- timeZone

  "UTC", "Asia/Seoul", …

- hour12

  12시간제 여부. true / false

- hourCycle

    - h11
    - h12
    - h23
    - h24
- weekday

    - long
    - short
    - narrow
- era

    - long
    - short
    - narrow
- year

    - numeric
    - 2-digit
- month

    - numeric
    - 2-digit
    - long
    - short
    - narrow
- day

    - numeric
    - 2-digit
- hour

    - numeric
    - 2-digit
- minute

    - numeric
    - 2-digit
- second

    - numeric
    - 2-digit
- timeZoneName

    - long
    - short

### NumberFormat

```javascript
let PRICE_FORMAT = new Intl.NumberFormat("ko-KR", {
    style: "currency", currency: "KRW",
    minimumFractionDigits: 2
});
console.log(PRICE_FORMAT.format(1000));
```

#### 매개변수 옵션

- style

    - decimal
    - currency
    - percent
- currency

  "USD", "EUR", KRW", …

- currencyDisplay

    - symbol
    - code
    - name
- useGrouping

  천 단위 구분자. true / false

- minimumIntegerDigits

- minimumFractionDigits

- maximumFractionDigits

- minimumSignificantDigits

- maximumSignificantDigits