More String utililities, used for web stuff.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2020-08-07 14:03:08 -05:00
parent ce7b7c5810
commit 1c54938532

View File

@ -2,11 +2,18 @@ Extension { #name : #String }
{ #category : #'*Grafoscopio-Utils' } { #category : #'*Grafoscopio-Utils' }
String >> asCapitalizedPhrase [ String >> asCapitalizedPhrase [
"I convert phrases like 'THIS IS A PHASE' into 'This is a Phrase'." "I convert phrases like 'THIS IS A PHRASE' into 'This is a Phrase'."
^ Character space join: (self substrings collect: [:each | each asLowercase capitalized ]) ^ 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' } { #category : #'*Grafoscopio-Utils' }
String >> isOrgModeHeader [ String >> isOrgModeHeader [
^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ') ^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')