2021-02-23 16:55:45 +00:00
|
|
|
Extension { #name : #String }
|
|
|
|
|
2022-03-18 14:44:29 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils' }
|
|
|
|
String >> accentedCharactersCorrection [
|
|
|
|
| modified corrections |
|
|
|
|
corrections := {
|
|
|
|
'ó' -> 'ó' . 'ú' -> 'ú' . 'ñ' -> 'ñ' .
|
2022-08-31 01:29:11 +00:00
|
|
|
'Ã' -> 'í' . 'á' -> 'á' . 'é' -> 'é' . 'â' -> $' asString} asDictionary.
|
2022-03-18 14:44:29 +00:00
|
|
|
modified := self copy.
|
|
|
|
corrections keysAndValuesDo: [ :k :v |
|
|
|
|
modified := modified copyReplaceAll: k with: v
|
|
|
|
].
|
|
|
|
^ modified
|
|
|
|
]
|
|
|
|
|
2021-02-23 16:55:45 +00:00
|
|
|
{ #category : #'*Grafoscopio-Utils' }
|
|
|
|
String >> asCapitalizedPhrase [
|
|
|
|
"I convert phrases like 'THIS IS A PHRASE' into 'This is a Phrase'."
|
|
|
|
|
|
|
|
^ Character space join: (self substrings collect: [:each | each asLowercase capitalized ])
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils' }
|
|
|
|
String >> asDashedLowercase [
|
|
|
|
"I convert phrases like 'This is a phrase' into 'this-is-a-phrase'."
|
|
|
|
|
|
|
|
^ '-' join: (self substrings collect: [:each | each asLowercase ])
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils' }
|
|
|
|
String >> correctAccentedCharacters [
|
|
|
|
|
|
|
|
| output |
|
|
|
|
output := self
|
|
|
|
copyReplaceAll: 'ó' with: 'ó'.
|
|
|
|
output := output copyReplaceAll: 'á' with: 'á'.
|
|
|
|
output := output copyReplaceAll: 'é' with: 'é'.
|
|
|
|
output := output copyReplaceAll: 'Ã' with: 'í'.
|
|
|
|
output := output copyReplaceAll: 'ú' with: 'ú'.
|
|
|
|
output := output copyReplaceAll: 'ñ' with: 'ñ'.
|
|
|
|
output := output copyReplaceAll: 'â' with: '“'.
|
|
|
|
output := output copyReplaceAll: 'â' with: '”'.
|
|
|
|
^ output
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #'*Grafoscopio-Utils' }
|
|
|
|
String >> isOrgModeHeader [
|
|
|
|
^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')
|
|
|
|
|
|
|
|
|
|
|
|
]
|