Skip to content

Commit 4edbd83

Browse files
authored
Merge pull request #17923 from allevato/unicode-properties-docs
2 parents 83e2684 + 5352545 commit 4edbd83

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

stdlib/public/core/UnicodeScalarProperties.swift

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ extension Unicode.Scalar.Properties {
237237
///
238238
/// This property roughly defines the class of "Chinese characters" and does
239239
/// not include characters of other logographic scripts such as Cuneiform or
240-
/// Egyptian Hieroglyphs
240+
/// Egyptian Hieroglyphs.
241241
///
242242
/// This property corresponds to the `Ideographic` property in the
243243
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
@@ -292,8 +292,8 @@ extension Unicode.Scalar.Properties {
292292
/// directs the rendering engine to render them as a connected glyph when it
293293
/// would otherwise render them independently. The zero width joiner is also
294294
/// used to construct complex emoji from sequences of base emoji characters.
295-
/// For example, "family" emoji are created by joining sequences of man,
296-
/// woman, and child emoji with the zero width joiner.
295+
/// For example, the various "family" emoji are encoded as sequences of man,
296+
/// woman, or child emoji that are interleaved with zero width joiners.
297297
///
298298
/// This property corresponds to the `Join_Control` property in the
299299
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
@@ -520,35 +520,35 @@ extension Unicode.Scalar.Properties {
520520
return _hasBinaryProperty(__swift_stdlib_UCHAR_CASE_IGNORABLE)
521521
}
522522

523-
/// A Boolean property indicating whether the scalar is one whose normalized
524-
/// form is not stable under a `toLowercase` mapping.
523+
/// A Boolean property indicating whether the scalar's normalized form differs
524+
/// from the `lowercaseMapping` of each constituent scalar.
525525
///
526526
/// This property corresponds to the `Changes_When_Lowercased` property in the
527527
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
528528
public var changesWhenLowercased: Bool {
529529
return _hasBinaryProperty(__swift_stdlib_UCHAR_CHANGES_WHEN_LOWERCASED)
530530
}
531531

532-
/// A Boolean property indicating whether the scalar is one whose normalized
533-
/// form is not stable under a `toUppercase` mapping.
532+
/// A Boolean property indicating whether the scalar's normalized form differs
533+
/// from the `uppercaseMapping` of each constituent scalar.
534534
///
535535
/// This property corresponds to the `Changes_When_Uppercased` property in the
536536
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
537537
public var changesWhenUppercased: Bool {
538538
return _hasBinaryProperty(__swift_stdlib_UCHAR_CHANGES_WHEN_UPPERCASED)
539539
}
540540

541-
/// A Boolean property indicating whether the scalar is one whose normalized
542-
/// form is not stable under a `toTitlecase` mapping.
541+
/// A Boolean property indicating whether the scalar's normalized form differs
542+
/// from the `titlecaseMapping` of each constituent scalar.
543543
///
544544
/// This property corresponds to the `Changes_When_Titlecased` property in the
545545
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
546546
public var changesWhenTitlecased: Bool {
547547
return _hasBinaryProperty(__swift_stdlib_UCHAR_CHANGES_WHEN_TITLECASED)
548548
}
549549

550-
/// A Boolean property indicating whether the scalar is one whose normalized
551-
/// form is not stable under case folding.
550+
/// A Boolean property indicating whether the scalar's normalized form differs
551+
/// from the case-fold mapping of each constituent scalar.
552552
///
553553
/// This property corresponds to the `Changes_When_Casefolded` property in the
554554
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
@@ -557,7 +557,7 @@ extension Unicode.Scalar.Properties {
557557
}
558558

559559
/// A Boolean property indicating whether the scalar may change when it
560-
/// undergoes a case mapping.
560+
/// undergoes case mapping.
561561
///
562562
/// For any scalar `s`, it holds by definition that
563563
///
@@ -753,10 +753,8 @@ extension Unicode.Scalar.Properties {
753753
/// WITH DOT ABOVE) becomes two scalars (U+0069 LATIN SMALL LETTER I, U+0307
754754
/// COMBINING DOT ABOVE) when converted to lowercase.
755755
///
756-
/// This function corresponds to the `Lowercase_Mapping` property in the
756+
/// This property corresponds to the `Lowercase_Mapping` property in the
757757
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
758-
///
759-
/// - Returns: The lowercase mapping of the scalar.
760758
public var lowercaseMapping: String {
761759
return _applyMapping(__swift_stdlib_u_strToLower)
762760
}
@@ -769,10 +767,8 @@ extension Unicode.Scalar.Properties {
769767
/// becomes "Fi" (U+0046 LATIN CAPITAL LETTER F, U+0069 LATIN SMALL LETTER I)
770768
/// when converted to titlecase.
771769
///
772-
/// This function corresponds to the `Titlecase_Mapping` property in the
770+
/// This property corresponds to the `Titlecase_Mapping` property in the
773771
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
774-
///
775-
/// - Returns: The titlecase mapping of the scalar.
776772
public var titlecaseMapping: String {
777773
return _applyMapping { ptr, cap, src, len, locale, err in
778774
return __swift_stdlib_u_strToTitle(ptr, cap, src, len, nil, locale, err)
@@ -787,10 +783,8 @@ extension Unicode.Scalar.Properties {
787783
/// SHARP S) becomes "SS" (U+0053 LATIN CAPITAL LETTER S, U+0053 LATIN CAPITAL
788784
/// LETTER S) when converted to uppercase.
789785
///
790-
/// This function corresponds to the `Uppercase_Mapping` property in the
786+
/// This property corresponds to the `Uppercase_Mapping` property in the
791787
/// [Unicode Standard](http://www.unicode.org/versions/latest/).
792-
///
793-
/// - Returns: The uppercase mapping of the scalar.
794788
public var uppercaseMapping: String {
795789
return _applyMapping(__swift_stdlib_u_strToUpper)
796790
}
@@ -1355,14 +1349,14 @@ extension Unicode.Scalar.Properties {
13551349
/// number.
13561350
///
13571351
/// ```
1358-
/// print("X", ("X" as Unicode.Scalar).properties.numericType)
1352+
/// print("X", ("X" as Unicode.Scalar).properties.numericType ?? "nil")
13591353
/// // Prints "X nil"
1360-
/// print("4", ("4" as Unicode.Scalar).properties.numericType)
1361-
/// // Prints "4 Optional(Swift.Unicode.NumericType.decimal)"
1362-
/// print("\u{2463}", ("\u{2463}" as Unicode.Scalar).properties.numericType)
1363-
/// // Prints "④ Optional(Swift.Unicode.NumericType.digit)"
1364-
/// print("\u{2155}", ("\u{2155}" as Unicode.Scalar).properties.numericType)
1365-
/// // Prints "⅕ Optional(Swift.Unicode.NumericType.numeric)"
1354+
/// print("4", ("4" as Unicode.Scalar).properties.numericType ?? "nil")
1355+
/// // Prints "4 decimal"
1356+
/// print("\u{2463}", ("\u{2463}" as Unicode.Scalar).properties.numericType ?? "nil")
1357+
/// // Prints "④ digit"
1358+
/// print("\u{2155}", ("\u{2155}" as Unicode.Scalar).properties.numericType ?? "nil")
1359+
/// // Prints "⅕ numeric"
13661360
/// ```
13671361
///
13681362
/// This property corresponds to the `Numeric_Type` property in the
@@ -1376,20 +1370,20 @@ extension Unicode.Scalar.Properties {
13761370

13771371
/// The numeric value of the scalar.
13781372
///
1379-
/// The value of this property is `nil` for scalars that do not represent a
1373+
/// The value of this property is nil for scalars that do not represent a
13801374
/// number.
13811375
///
13821376
/// The numeric value of a scalar is represented as a `Double` because some
13831377
/// scalars represent fractions:
13841378
///
13851379
/// ```
1386-
/// print("X", ("X" as Unicode.Scalar).properties.numericValue)
1387-
/// // Prints "X nan"
1388-
/// print("4", ("4" as Unicode.Scalar).properties.numericValue)
1380+
/// print("X", ("X" as Unicode.Scalar).properties.numericValue ?? "nil")
1381+
/// // Prints "X nil"
1382+
/// print("4", ("4" as Unicode.Scalar).properties.numericValue ?? "nil")
13891383
/// // Prints "4 4.0"
1390-
/// print("\u{2463}", ("\u{2463}" as Unicode.Scalar).properties.numericValue)
1384+
/// print("\u{2463}", ("\u{2463}" as Unicode.Scalar).properties.numericValue ?? "nil")
13911385
/// // Prints "④ 4.0"
1392-
/// print("\u{2155}", ("\u{2155}" as Unicode.Scalar).properties.numericValue)
1386+
/// print("\u{2155}", ("\u{2155}" as Unicode.Scalar).properties.numericValue ?? "nil")
13931387
/// // Prints "⅕ 0.2"
13941388
/// ```
13951389
///

0 commit comments

Comments
 (0)