CharacterArray.st
changeset 5848 ef81d77ca1ad
parent 5843 9fe653bcf3e1
child 5898 7bc4f1593b4e
equal deleted inserted replaced
5847:aab6e1f01f55 5848:ef81d77ca1ad
  4594     "return an article string for the receiver."
  4594     "return an article string for the receiver."
  4595 
  4595 
  4596     |firstChar|
  4596     |firstChar|
  4597 
  4597 
  4598     firstChar := (self at:1) asLowercase. 
  4598     firstChar := (self at:1) asLowercase. 
  4599     (firstChar isVowel or:[firstChar == $x]) ifTrue:[
  4599     ((firstChar isVowel and:[firstChar ~~ $u]) or:[firstChar == $x]) ifTrue:[
  4600 	firstChar ~~ $u ifTrue:[
  4600         ^ 'an'
  4601 	     ^ 'an'
       
  4602 	]
       
  4603     ].
  4601     ].
  4604     ^ 'a'
  4602     ^ 'a'
       
  4603 
       
  4604     "
       
  4605         'uboot' article.
       
  4606         'xmas' article.
       
  4607         'alarm' article.
       
  4608         'baby' article.
       
  4609     "
  4605 !
  4610 !
  4606 
  4611 
  4607 displayString
  4612 displayString
  4608     "return a string to display the receiver - use storeString to have
  4613     "return a string to display the receiver - use storeString to have
  4609      quotes around."
  4614      quotes around."
  4631         aStream nextPut:thisChar
  4636         aStream nextPut:thisChar
  4632     ]
  4637     ]
  4633 
  4638 
  4634     "Modified: / 15.6.1998 / 17:21:17 / cg"
  4639     "Modified: / 15.6.1998 / 17:21:17 / cg"
  4635     "Created: / 15.6.1998 / 17:22:13 / cg"
  4640     "Created: / 15.6.1998 / 17:22:13 / cg"
       
  4641 !
       
  4642 
       
  4643 utf8Encoded
       
  4644     "convert a string of ISO8859-1 charcters to its UTF-8 representation.
       
  4645      this returns a String"
       
  4646 
       
  4647     |s|
       
  4648 
       
  4649     s := (String new:self size) writeStream.
       
  4650     self utf8EncodedOn:s.
       
  4651     ^ s contents
       
  4652 !
       
  4653 
       
  4654 utf8EncodedOn:aStream
       
  4655 
       
  4656     self do:[:c|
       
  4657         c utf8EncodedOn:aStream.
       
  4658     ].
       
  4659 
       
  4660     "
       
  4661       'Dies ist ein Test mit {} und Ümläuten' utf8Encoded
       
  4662     "
  4636 ! !
  4663 ! !
  4637 
  4664 
  4638 !CharacterArray methodsFor:'queries'!
  4665 !CharacterArray methodsFor:'queries'!
  4639 
  4666 
  4640 bitsPerCharacter
  4667 bitsPerCharacter
  4720     "
  4747     "
  4721 
  4748 
  4722     "Created: 12.5.1996 / 20:09:29 / cg"
  4749     "Created: 12.5.1996 / 20:09:29 / cg"
  4723     "Modified: 17.4.1997 / 12:50:23 / cg"
  4750     "Modified: 17.4.1997 / 12:50:23 / cg"
  4724 ! !
  4751 ! !
       
  4752 
  4725 
  4753 
  4726 !CharacterArray methodsFor:'special string converting'!
  4754 !CharacterArray methodsFor:'special string converting'!
  4727 
  4755 
  4728 chopTo:maxLen
  4756 chopTo:maxLen
  4729     "if the receivers size is less or equal to maxLen, return it.
  4757     "if the receivers size is less or equal to maxLen, return it.
  5889 ! !
  5917 ! !
  5890 
  5918 
  5891 !CharacterArray class methodsFor:'documentation'!
  5919 !CharacterArray class methodsFor:'documentation'!
  5892 
  5920 
  5893 version
  5921 version
  5894     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.202 2001-04-09 15:24:17 cg Exp $'
  5922     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.203 2001-04-23 13:00:22 stefan Exp $'
  5895 ! !
  5923 ! !
  5896 CharacterArray initialize!
  5924 CharacterArray initialize!