280 ^ EncodingFailedSignal |
280 ^ EncodingFailedSignal |
281 |
281 |
282 "Modified: 28.6.1997 / 20:09:35 / cg" |
282 "Modified: 28.6.1997 / 20:09:35 / cg" |
283 "Created: 3.8.1997 / 18:16:40 / cg" |
283 "Created: 3.8.1997 / 18:16:40 / cg" |
284 ! ! |
284 ! ! |
|
285 |
285 |
286 |
286 !CharacterArray class methodsFor:'cleanup'! |
287 !CharacterArray class methodsFor:'cleanup'! |
287 |
288 |
288 lowSpaceCleanup |
289 lowSpaceCleanup |
289 "cleanup in low-memory situations" |
290 "cleanup in low-memory situations" |
4267 |
4268 |
4268 "Modified: / 11-05-2010 / 19:12:37 / cg" |
4269 "Modified: / 11-05-2010 / 19:12:37 / cg" |
4269 ! ! |
4270 ! ! |
4270 |
4271 |
4271 |
4272 |
|
4273 |
|
4274 |
4272 !CharacterArray methodsFor:'matching - glob expressions'! |
4275 !CharacterArray methodsFor:'matching - glob expressions'! |
4273 |
4276 |
4274 compoundMatch:aString |
4277 compoundMatch:aString |
4275 "like match, but the receiver may be a compound match pattern, |
4278 "like match, but the receiver may be a compound match pattern, |
4276 consisting of multiple simple GLOB patterns, separated by semicolons. |
4279 consisting of multiple simple GLOB patterns, separated by semicolons. |
4950 |
4953 |
4951 "Created: / 08-03-2012 / 03:11:11 / cg" |
4954 "Created: / 08-03-2012 / 03:11:11 / cg" |
4952 ! ! |
4955 ! ! |
4953 |
4956 |
4954 |
4957 |
|
4958 |
4955 !CharacterArray methodsFor:'padded copying'! |
4959 !CharacterArray methodsFor:'padded copying'! |
4956 |
4960 |
4957 centerPaddedTo:newSize |
4961 centerPaddedTo:newSize |
4958 "return a new string consisting of the receivers characters, |
4962 "return a new string consisting of the receivers characters, |
4959 plus spaces up to length and center the receivers characters in |
4963 plus spaces up to length and center the receivers characters in |
5112 article |
5116 article |
5113 "return an article string for the receiver. |
5117 "return an article string for the receiver. |
5114 The original code only looked at the first character being a vowel; |
5118 The original code only looked at the first character being a vowel; |
5115 this has been enhanced by some heuristics - not perfect, still." |
5119 this has been enhanced by some heuristics - not perfect, still." |
5116 |
5120 |
5117 |firstChar| |
5121 |firstChar secondChar| |
5118 |
5122 |
5119 firstChar := (self at:1) asLowercase. |
5123 firstChar := (self at:1) asLowercase. |
5120 ((firstChar isVowel and:[firstChar ~~ $u]) or:[firstChar == $x]) ifTrue:[ |
5124 ((firstChar isVowel and:[firstChar ~~ $u]) or:[firstChar == $x]) ifTrue:[ |
5121 ^ 'an' |
5125 ^ 'an' |
5122 ]. |
5126 ]. |
5123 |
5127 |
5124 (self size >= 3) ifTrue:[ |
5128 (self size >= 3) ifTrue:[ |
|
5129 secondChar := (self at:2) asLowercase. |
5125 (firstChar isVowel not |
5130 (firstChar isVowel not |
5126 and:[(self at:2) isVowel not |
5131 and:[(secondChar isVowel or:[secondChar == $y]) not |
5127 and:[(self at:3) isVowel not ]]) ifTrue:[ |
5132 and:[(self at:3) isVowel not ]]) ifTrue:[ |
5128 "/ exceptions: 3 non-vowels in a row: looks like an abbreviation |
5133 "/ exceptions: 3 non-vowels in a row: looks like an abbreviation |
5129 (self size > 4) ifTrue:[ |
5134 (self size > 4) ifTrue:[ |
5130 ((self asLowercase startsWith:'scr') and:[(self at:4) isVowel]) ifTrue:[ |
5135 ((self asLowercase startsWith:'scr') and:[(self at:4) isVowel]) ifTrue:[ |
5131 ^ 'a' |
5136 ^ 'a' |
7175 "dispatch for visitor pattern; send #visitString:with: to aVisitor" |
7181 "dispatch for visitor pattern; send #visitString:with: to aVisitor" |
7176 |
7182 |
7177 ^ aVisitor visitString:self with:aParameter |
7183 ^ aVisitor visitString:self with:aParameter |
7178 ! ! |
7184 ! ! |
7179 |
7185 |
|
7186 |
7180 !CharacterArray class methodsFor:'documentation'! |
7187 !CharacterArray class methodsFor:'documentation'! |
7181 |
7188 |
7182 version |
7189 version |
7183 ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.554 2014-11-28 15:15:26 cg Exp $' |
7190 ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.555 2014-11-29 18:20:34 cg Exp $' |
7184 ! |
7191 ! |
7185 |
7192 |
7186 version_CVS |
7193 version_CVS |
7187 ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.554 2014-11-28 15:15:26 cg Exp $' |
7194 ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.555 2014-11-29 18:20:34 cg Exp $' |
7188 ! ! |
7195 ! ! |
7189 |
7196 |
7190 |
7197 |
7191 CharacterArray initialize! |
7198 CharacterArray initialize! |