Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Selectors of String and Text
Last updated at 9:54 am UTC on 19 July 2022
Squeak 6.0
 String superclass ArrayedCollection 
 Text superclass ArrayedCollection 

 String selectors  size  314 
 Text selectors size  100 

txsel := Text selectors asSet.
stsel := String selectors asSet.

commonSelectors := stsel select: [:sel | txsel includes: sel].

commonSelectors size 42 


txsel := Text selectors asSet.
stsel := String selectors asSet.

stsel select: [:sel | txsel includes: sel] a Set(#storeOn: #asUrlRelativeTo: #withoutLeadingBlanks #edit 
#hash #asMorph #basicType #printOn: #asDisplayText #replaceFrom:to:with:startingAt: #lineCount
 #editWithLabel: #copyReplaceTokens:with: #asString #format: #asStringOrText
 #isoToSqueak #<=> #asUrl #asSymbol #asStringMorph #macToSqueak #findString:startingAt:
 #withSqueakLineEndings #applyLanguageInformation: #asNumber #findString:startingAt:caseSensitive:
 #squeakToMac #howManyMatch: #hashWithInitialHash: #asText #canonicalArgumentName #deepCopy 
#string #= #askIfAddStyle:req: #withNoLineLongerThan: #asParagraph #translated #jsonWriteOn: 
#withBlanksTrimmed #squeakToIso) 




String
 findString: subString startingAt: start 
	"Answer the index of subString within the receiver, starting at start. If 
	the receiver does not contain subString, answer 0."

	^self findString: subString startingAt: start caseSensitive: true

Text
 findString: aString startingAt: start 
	"Answer the index of subString within the receiver, starting at index 
	start. If the receiver does not contain subString, answer 0."

	^string findString: aString asString startingAt: start



String
 withoutLeadingBlanks

	"Return a copy of the receiver from which leading blanks have been trimmed."

	| first |
	first := self findFirst: [:c | c isSeparator not ].
	first = 0 ifTrue: [^ ''].  	
	"no non-separator character"
	
	^ self copyFrom: first to: self size

	
		
	" '    abc  d' withoutLeadingBlanks"

Text
 withoutLeadingBlanks
	"Return a copy of the receiver from which leading blanks have been trimmed."

	| first |
	first := string indexOfAnyOf: CharacterSet nonSeparators startingAt: 1.
	first = 0 ifTrue: [ ^'' ].  "no non-separator character"
	first = 1 ifTrue: [ ^self copy ].
	^self
		copyFrom: first
		to: self size