神岛 API 文档 - ArenaPro版
    Preparing search index...

    一个接口,提供对语言敏感的字符串比较功能。

    An interface that provides language-sensitive string comparison.

    interface Collator {
        compare(x: string, y: string): number;
        resolvedOptions(): ResolvedCollatorOptions;
    }
    Index

    Methods

    • Parameters

      • x: string
      • y: string

      Returns number

      比较两个字符串。

      Compares two strings.

      要比较的第一个字符串。

      The first string to compare.

      要比较的第二个字符串。

      The second string to compare.

      一个数字,指示 x 是在 y 之前、之后还是与 y 相同。

      • 如果 xy 之前,则为负数。
      • 如果 xy 之后,则为正数。
      • 如果 xy 相等,则为 0。

      A number indicating whether x comes before, after, or is the same as y.

      • A negative value if x comes before y.
      • A positive value if x comes after y.
      • 0 if x and y are equal.