Hi Tim
Those constructions are in the method comments of ByteString for that method.
"
' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 1 matchTable: CaseSensitiveOrder 1
' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 2 matchTable: CaseSensitiveOrder 7
' ' findSubstring: 'abc' in: 'abcdefabcd' startingAt: 8 matchTable: CaseSensitiveOrder 0
' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable: CaseSensitiveOrder 0
' ' findSubstring: 'abc' in: 'abcdefABcd' startingAt: 2 matchTable: CaseInsensitiveOrder 7
"
Regarding "not a class, but a class variable"
I open a browser and search for the class Tokenish.
It shows up in Category Unknown as a sub-class of Object
Object subclass: #Tokenish
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Unknown'
so I am unsure what you are referring to here. Maybe squeak has evolved in the year or so I have been busy with menial labor work.
Thank you for your time.
cordially
t
---- On Mon, 18 Sep 2023 12:39:04 -0400 Tim Rowledge tim@rowledge.org wrote ---
Well, Tokenish isn't a class, it's a class variable containing a list of all the characters considered 'tokenish' (see Character>>#tokenish).
You really shouldn't find yourself using constructions like
String classPool at: #CaseSensitiveOrder
.. to do so implies some pretty serious misunderstanding somewhere along the line.
If you want to find a substring you really ought to use String>>#findString:startingAt:caseSensitive: if you need to control the case sensitivity, or just String>>#findString:startingAt: if the default of true is ok.
Assuming your problem is a bit more general in that you need to split two-word phrases that have been agglomerated, we might try
|input firstOne| input := 'complexgrammar'. firstOne := 'complex'.
^String streamContents: [:strm| strm nextPutAll: firstOne capitalized. strm space. strm nextPutAll: (input allButFirst: firstOne size) capitalized]
Note that this doesn't do any checking of the existence of anything after the firstOne string, or even that firstOne exists within input.
On 2023-09-18, at 6:33 AM, gettimothy via Squeak-dev mailto:squeak-dev@lists.squeakfoundation.org wrote:
fwiw, here is what I came up with.
If anybody knows an elegant way to do this, much appreciated.
|str f l r| str := 'complexgrammar'. f := (str from: 1 to:(str findSubstring: 'grammar' in:str startingAt: 1 matchTable: ( String classPool at: #CaseSensitiveOrder)) -1). l := (str from: (str findSubstring: 'grammar' in:str startingAt: 1 matchTable: ( String classPool at: #CaseSensitiveOrder)) to:(str size)). r := (f capitalized) , ' ' , (l capitalized) . r inspect
---- On Mon, 18 Sep 2023 09:16:02 -0400 gettimothy via Squeak-dev mailto:squeak-dev@lists.squeakfoundation.org wrote ---
Hi folks.
I am trying to figure out how to separate some words in a string 'complexgrammar' so I can print Complex Grammar.
looking for solutions, I find Tokenish, a class that does nothing with no comment.
I think it may be a former colleague of mine.
tim