-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to String >> copyWith: when the argument requires an UnicodeStrin…
…g answer.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
CoreUpdates/6858-String-copyWith-fix-JuanVuletich-2024Nov26-15h59m-jmv.001.cs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'From Cuis7.1 [latest update: #6857] on 26 November 2024 at 4:16:59 pm'! | ||
|
||
!Character commentStamp: '<historical>' prior: 0! | ||
I represent a character or Unicode Code Point. My instances are the elements of the CharacterSequence hierarchy, including String and UnicodeString.! | ||
|
||
|
||
!String methodsFor: 'copying' stamp: 'jmv 11/26/2024 16:09:46'! | ||
copyWith: newElement | ||
newElement codePoint > 255 ifTrue: [ | ||
^self asUnicodeString copyWith: newElement ]. | ||
^super copyWith: newElement! ! | ||
|
||
|
||
!Character methodsFor: 'accessing' stamp: 'jmv 11/26/2024 16:00:43'! | ||
asciiValue | ||
"Answer the value of the receiver that represents its ASCII encoding. | ||
This is the same as the Unicode Code Point for the first 128 characters. | ||
Answer nil if out of range, i.e. we are not part of the ASCII Character set." | ||
|
||
| n | | ||
n := self codePoint. | ||
^ n < 128 ifTrue: [ n ].! ! | ||
|