Levente Uzonyi uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-ul.199.mcz ==================== Summary ==================== Name: Multilingual-ul.199 Author: ul Time: 7 July 2014, 9:30:04.831 pm UUID: 0d703c05-fa3a-42a6-aaa0-c0c57a0395fb Ancestors: Multilingual-nice.198 EncodedCharSet class changes - introduced #isAlphaNumeric: and #isAlphaNumericCode: Unicode class changes: - introduced #generalCategoryOf: which returns the corresponding GeneralCategory value for the given character code - all is*Code: methods use #generalCategoryOf: =============== Diff against Multilingual-nice.198 =============== Item was added: + ----- Method: EncodedCharSet class>>isAlphaNumeric: (in category 'character classification') ----- + isAlphaNumeric: char + "Answer whether char has the code of a letter or a digit in this encoding." + + ^self isAlphaNumericCode: char charCode + ! Item was added: + ----- Method: EncodedCharSet class>>isAlphaNumericCode: (in category 'character classification') ----- + isAlphaNumericCode: anInteger + "Answer whether anInteger is the code of a letter or a digit." + + ^(self isLetterCode: anInteger) or: [ self isDigitCode: anInteger ] + ! Item was added: + ----- Method: Unicode class>>generalCategoryOf: (in category 'character classification') ----- + generalCategoryOf: aCharacterCode + + | index | + (index := aCharacterCode + 1) > GeneralCategory size ifTrue: [ ^nil ]. + ^GeneralCategory at: index + ! Item was added: + ----- Method: Unicode class>>isAlphaNumericCode: (in category 'character classification') ----- + isAlphaNumericCode: charCode + + | codeCategory | + (codeCategory := self generalCategoryOf: charCode) < Ll ifTrue: [ ^false ]. + codeCategory <= Lu ifTrue: [ ^true ]. + ^codeCategory = Nd + ! Item was changed: ----- Method: Unicode class>>isComposition: (in category 'character classification') ----- + isComposition: aCharacter - isComposition: aChar + ^(self generalCategoryOf: aCharacter charCode) = Mn! - ^ (GeneralCategory at: aChar charCode + 1) = Mn - ! Item was changed: ----- Method: Unicode class>>isDigitCode: (in category 'character classification') ----- + isDigitCode: charCode + + ^(self generalCategoryOf: charCode) = Nd! - isDigitCode: charCode - charCode > (GeneralCategory size - 1) - ifTrue: [^ false]. - ^ (GeneralCategory at: charCode + 1) - = Nd! Item was changed: ----- Method: Unicode class>>isLetterCode: (in category 'character classification') ----- isLetterCode: charCode + + | codeCategory | + (codeCategory := self generalCategoryOf: charCode) < Ll ifTrue: [ ^false ]. + ^codeCategory <= Lu! - | codeCat | - charCode > (GeneralCategory size - 1) - ifTrue: [^ false]. - ^ (codeCat := GeneralCategory at: charCode + 1) >= Ll - and: [codeCat <= Lu]! Item was changed: ----- Method: Unicode class>>isLowercaseCode: (in category 'character classification') ----- isLowercaseCode: charCode + + ^(self generalCategoryOf: charCode) = Ll! - charCode > (GeneralCategory size - 1) - ifTrue: [^ false]. - ^ (GeneralCategory at: charCode + 1) - = Ll! Item was changed: ----- Method: Unicode class>>isUppercaseCode: (in category 'character classification') ----- isUppercaseCode: charCode + + ^(self generalCategoryOf: charCode) = Lu! - charCode > (GeneralCategory size - 1) - ifTrue: [^ false]. - ^ (GeneralCategory at: charCode + 1) - = Lu! |
Free forum by Nabble | Edit this page |