* (123102499) Swift implementation of setAttributes:forItemAtPath: is slower than the old ObjC implementation
* Move relevant key list to static array
* Fix build failure
* Use smaller buffer for file system representation
* Reword scalars -> code-units
Co-authored-by: Karl <5254025+karwa@users.noreply.github.com>
---------
Co-authored-by: Karl <5254025+karwa@users.noreply.github.com>
* Follow up for #278 : make the required function from FoundationEssentials `package` so we can use it from FoundationI18n
* Workaround TAPI error by removing the default arguments
* (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.
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.
These started by converting `self` into a `String`. This lead to crashes when `self` happened to be a Substring, as the input range isn’t necessarily a valid index range in the resulting string in that case.
While I’m here, review related helper functions to improve performance and to avoid more correctness issues.
* 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:)
* Generalize trimming function to take a predicate block. Move this function to FoundationEssentials.
* Call `_trimmingWhitespaces()` instead of through CharacterSet.
* Review feedback: rename the function to whitespace from whitespaces
* Add tests
* Standarize whitespacing and remove spaces in empty line
* Remove String._Encoding
Previously we added a new type `String._Encoding` for FoundationPreview to mirror Foundation framework's `String.Encoding` to work around Clang importer's ambiguous lookup issue. It turns out that the new type isn't needed for this workaround. Adding a typealias itself is sufficient.
* String.Encoding can conform to Hashable universally
* Revert "Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials (#101)"
This reverts commit 8f08a649db1f3eb31593cdae7a30c5e95cb614a7.
* Reapply fb718cd3fb9f058a5fd6d736cec9c2b99d6f7dc6 fix to the other restored LockedState
* Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials
- Modules will access FoundationInternals types with `package import FoundationInternals`. This is currently an experimental feature of `AccessLevelOnImport`.
- Move `LockedState` to FoundationInternals and publicize functions needed by other modules.
* fix memory binding
* use `load(as:)` instead of binding memory
* Use temporary binding rather than `bindMemory`
* use `load(as:)` and `storeBytes(of:as:)` as appropriate
* use temporary binding rather than binding assertions
* add a note about index validation
* 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>