GrafoscopioUtils/repository/Grafoscopio-Utils/String.extension.st

23 lines
622 B
Smalltalk
Raw Normal View History

2020-05-02 13:28:13 +00:00
Extension { #name : #String }
{ #category : #'*Grafoscopio-Utils' }
String >> asCapitalizedPhrase [
"I convert phrases like 'THIS IS A PHRASE' into 'This is a Phrase'."
2020-05-02 13:28:13 +00:00
^ 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 ])
]
2020-05-02 13:28:13 +00:00
{ #category : #'*Grafoscopio-Utils' }
String >> isOrgModeHeader [
^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')
]