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?

servicenow parseInt カンマあると、カンマ以降が消えちゃう

Posted at
qiita.rb
parseInt('12', 10); // 12
parseInt("015", 10); // 15
parseInt('12.3', 10); // 12
parseInt('12.9', 10); // 12
parseInt('12.00', 10); // 12
parseInt("12.03", 10); // 12
parseInt("0.35", 10); // 0
parseInt("15,123", 10); // 15 → カンマあるとカンマ以降が消えちゃう。。。
parseInt(undefined, 10); // NaN
parseInt(null, 10); // NaN
parseInt('', 10); // NaN

qiita.rb
var input = ""; // 空欄の場合のデフォルト値設定
var numericValue = input ? parseFloat(input.replace(/,/g, '')) : 0;

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?