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?

数値と文字列の不等式

Last updated at Posted at 2023-12-07

不等式

シンプルな事ですが、
数値の不等式と文字列不等式は結果が異なります。
当たり前のように聞こえますが、
基準が異なるために起こります。

数値の場合は数値同士の差分による結果
文字列の場合はUnicodeに沿ったポイントの差(unicode上の並び順というイメージ)

数値
9<10 結果 true

文字列
"9" < "10" 結果 false

これは9より1の方がunicodeのポイントが小さい為。
※さらに細かい理由は分かったら追記します。

0
0
2

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?