Correcting Spanish accented characters, when they come from the terminal output (e.g. via OSSubprocess).

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-03-18 09:44:29 -05:00
parent da8eaeb9a6
commit f3551de1de

View File

@ -1,5 +1,18 @@
Extension { #name : #String } Extension { #name : #String }
{ #category : #'*Grafoscopio-Utils' }
String >> accentedCharactersCorrection [
| modified corrections |
corrections := {
'ó' -> 'ó' . 'ú' -> 'ú' . 'ñ' -> 'ñ' .
'í' -> 'í' . 'á' -> 'á' . 'é' -> 'é' } asDictionary.
modified := self copy.
corrections keysAndValuesDo: [ :k :v |
modified := modified copyReplaceAll: k with: v
].
^ modified
]
{ #category : #'*Grafoscopio-Utils' } { #category : #'*Grafoscopio-Utils' }
String >> asCapitalizedPhrase [ String >> asCapitalizedPhrase [
"I convert phrases like 'THIS IS A PHRASE' into 'This is a Phrase'." "I convert phrases like 'THIS IS A PHRASE' into 'This is a Phrase'."