0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

文字列を操作するメソッド

Posted at

よく使う文字列系メソッドについてまとめる.
※今後も継続して追加予定

###trim()メソッド
trimメソッドは,文字列の両端の空白を削除した文字列を返すメソッド.

const str = '   Hello!    '
console.log(str.trim())
//Hello!

###split()メソッド
splitメソッドは,引数で渡した文字列を取り除き,その前後で文字列の配列を生成するメソッド.

const str = 'abcdefg'
console.log(str.split('d'))
//['abc','efg']
console.log(str.split('de'))
//['abc','fg']
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?