13 Commits

Author SHA1 Message Date
Jonathan Flat
523ffcb1a4
Port UIDNAHook to FoundationInternationalization (#746) 2024-07-22 12:30:22 -07:00
Jeremy Schonfeld
f270f75171
(125852961) Use ICU-equivalent \b behavior with Regex for String.range(of:) (#590) 2024-05-07 15:58:49 -07:00
Charles Hu
7272a47c0b
Refactoring some import conditions (#298) 2023-10-25 15:11:37 -07:00
Tony Parker
3d52b255b7
Move String additions from _FoundationInternals to FoundationEssentials + package (#282) 2023-10-04 16:38:28 -07:00
Tony Parker
9fae9b1c6b
Revert "Move String additions from _FoundationInternals to FoundationEssentials + package" (#281)
This reverts commit 3a17834c7f397c9b83085008cad99eca7d7f3735.
2023-10-04 15:39:55 -07:00
Tony Parker
3a17834c7f
Move String additions from _FoundationInternals to FoundationEssentials + package 2023-10-04 15:24:17 -07:00
Tina Liu
9df5dc6518
(112770879) “Washington, D.c.” capitalized incorrectly (#212)
* (112770879) “Washington, D.c.” capitalized incorrectly

Theoretically "." is a case-ignorable character, so "D.C." is conceptually the same as "DC", whose capitalized mapping would be "Dc". This behavior doesn't seem to align with real-world use cases well though. Workaround this by splitting the string with "." and titlecasing each substring individually.

* (112770879) “Washington, D.c.” capitalized incorrectly, cont.

For FoundationPreview: Move String comparison utilities from FoundationEssentials fo _FoundationInternals so they can be accessed from FoundationInternalization too.
2023-07-31 10:51:34 -07:00
Tina Liu
1402b8cff1
rdar://111921940 (SEED: Swift runtime' string parsing behavior regressed in Dawnburst.) (#198)
We had a fast path implemented incorrectly: We search the UTF8 code unit whenever possible, and convert the found UTF8 index back to String index. If the conversion fails, i.e. when the found UTF8 index does not fall on a character boundary, we simply bail and return nil. The correct implementation should be advancing the slice from the point of failure and keeping searching.

But we don't really need this fast path here as we already have another one that skips string transformation inside the helper function. Let's just remove this.
2023-07-13 08:34:19 -07:00
Joey
32bf8bc848
Documentation - Consistency Fixes (#187)
* Documentation for attributed string's number formatting.

* Documentation - Typos & Consistency Fixes
2023-06-29 10:55:29 -07:00
Charles Hu
14eb5a1f60
Addressed compiler warnings and updated the incorrect license headers (#190) 2023-06-28 11:00:02 -07:00
Tina Liu
7f8f56cf95
Work towards: Stop calling into Foundation's implementation (#153)
* Use stdlib's `replacing(:with:)` instead of NSString's `replacingOccurrences(of:with:)`
* Move internal implementation of `_range(of:anchored:backwards:)` to _FoundationInternals. Update callsites to use this instead of NSString's `range(of:)` implementation.
Note: we should consider moving to stdlib's `firstRange(of:)` once rdar://109910336 is addressed.
* Add tests for _range(of:anchored:backwards:)
2023-05-30 15:53:28 -07:00
Charles Hu
c01e9dadee
rdar://107955097 (FoundationPreview: Batch move string API (continued)) (#34)
* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move localized uppercase and lowercase to FoundationLocalization
- if-def out of CharacterSet from FoundationPreview. It's not implemented at all there, and having a no-op stub is misleading

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move components separated by string and range of string functions

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

Enable snake case options for JSON encoder and decoder. We haven't been able to enable this option because it needed `CharacterSet`, which hasn't been properly implemented for FoundationPreview. Now that we have `BuiltInUnicodeScalarSet`, which mirrors `CharacterSet`, we can switch to that and enable the options.

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move `StringProtocol.lineRange(for:)` and `paragraphRange(for:)` to FoundationEssentials
- Rename String+Regex.swift to RegexPatternCache.swift
- Consolidate extensions on various String family members and remove one redundant swift file

---------

Co-authored-by: I-Ting Tina Liu <iting_liu@apple.com>
2023-04-17 18:23:51 -07:00
Charles Hu
34c45c169c rdar://107156343 (Move JSONEncoder to FoundationPreview) 2023-03-29 09:56:00 -07:00