From 1c549385329e9eaab7a2ef6b6d0a2891989275f9 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Fri, 7 Aug 2020 14:03:08 -0500 Subject: [PATCH] More String utililities, used for web stuff. --- repository/Grafoscopio-Utils/String.extension.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repository/Grafoscopio-Utils/String.extension.st b/repository/Grafoscopio-Utils/String.extension.st index 6c65f1e..53dbdb9 100644 --- a/repository/Grafoscopio-Utils/String.extension.st +++ b/repository/Grafoscopio-Utils/String.extension.st @@ -2,11 +2,18 @@ Extension { #name : #String } { #category : #'*Grafoscopio-Utils' } 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 ]) ] +{ #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 >> isOrgModeHeader [ ^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')