Character.st
changeset 23852 d2f4756deae3
parent 23778 971693ebe429
child 23950 308a94fcf0cd
equal deleted inserted replaced
23851:5ff57df8afe9 23852:d2f4756deae3
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1988 by Claus Gittinger
     2  COPYRIGHT (c) 1988 by Claus Gittinger
     5 	      All Rights Reserved
     3 	      All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
   321     "return a character with codePoint anInteger - backward compatibility"
   319     "return a character with codePoint anInteger - backward compatibility"
   322 
   320 
   323     ^ self codePoint:anInteger
   321     ^ self codePoint:anInteger
   324 ! !
   322 ! !
   325 
   323 
       
   324 
   326 !Character class methodsFor:'accessing untypeable characters'!
   325 !Character class methodsFor:'accessing untypeable characters'!
   327 
   326 
   328 controlCharacter:char
   327 controlCharacter:char
   329     "Answer the Character representing ctrl-char.
   328     "Answer the Character representing ctrl-char.
   330      ctrl-a -> 1; ctrl-@ -> 0"
   329      ctrl-a -> 1; ctrl-@ -> 0"
   378 rightParenthesis
   377 rightParenthesis
   379     "Answer the Character representing a right parenthesis."
   378     "Answer the Character representing a right parenthesis."
   380 
   379 
   381     ^ self codePoint:41
   380     ^ self codePoint:41
   382 ! !
   381 ! !
       
   382 
   383 
   383 
   384 !Character class methodsFor:'constants'!
   384 !Character class methodsFor:'constants'!
   385 
   385 
   386 backspace
   386 backspace
   387     "return the backspace character"
   387     "return the backspace character"
   648     "
   648     "
   649      Character separators
   649      Character separators
   650     "
   650     "
   651 ! !
   651 ! !
   652 
   652 
       
   653 
   653 !Character methodsFor:'Compatibility-Dolphin'!
   654 !Character methodsFor:'Compatibility-Dolphin'!
   654 
   655 
   655 isAlphaNumeric
   656 isAlphaNumeric
   656     "Compatibility method for dolphin and VSE - do not use in new code.
   657     "Compatibility method for dolphin and VSE - do not use in new code.
   657      Return true, if I am a letter or a digit
   658      Return true, if I am a letter or a digit
   857     self codePoint == aCharacter codePoint ifTrue:[^ true].
   858     self codePoint == aCharacter codePoint ifTrue:[^ true].
   858     ^ self asLowercase codePoint == aCharacter asLowercase codePoint.
   859     ^ self asLowercase codePoint == aCharacter asLowercase codePoint.
   859 
   860 
   860     "
   861     "
   861       (Character value:345) sameAs:(Character value:345)
   862       (Character value:345) sameAs:(Character value:345)
   862       $Ж sameAs:$ж 
   863       $Ж sameAs:$ж 
   863       $ж sameAs:$Ж 
   864       $ж sameAs:$Ж 
   864     "
   865     "
   865 
   866 
   866     "Modified (comment): / 28-03-2017 / 16:19:48 / stefan"
   867     "Modified (comment): / 28-03-2017 / 16:19:48 / stefan"
   867 !
   868 !
   868 
   869 
  1556     s := WriteStream on:(String new:self utf8BytesPerCharacter).
  1557     s := WriteStream on:(String new:self utf8BytesPerCharacter).
  1557     s nextPutUtf8:self.
  1558     s nextPutUtf8:self.
  1558     ^ s contents
  1559     ^ s contents
  1559 
  1560 
  1560     "
  1561     "
  1561      'ä' utf8Encoded
  1562      'ä' utf8Encoded
  1562      'a' utf8Encoded
  1563      'a' utf8Encoded
  1563     "
  1564     "
  1564 
  1565 
  1565     "Modified: / 07-02-2017 / 14:37:06 / stefan"
  1566     "Modified: / 07-02-2017 / 14:37:06 / stefan"
  1566 !
  1567 !
  1567 
  1568 
  1568 withoutDiacritics
  1569 withoutDiacritics
       
  1570     <resource: #todo>
  1569     "return a character with same letter as the receiver, but in without diacritics modifiers
  1571     "return a character with same letter as the receiver, but in without diacritics modifiers
  1570      (mapping e.g. Ä to A).
  1572      (mapping e.g. Ä to A).
  1571      Returns the receiver if it has no diacritics modifiers."
  1573      Returns the receiver if it has no diacritics modifiers."
  1572 
  1574 
  1573     ^ self shouldImplement
  1575     ^ self shouldImplement
  1574 
  1576 
  1575     "Created: / 28-03-2017 / 16:01:45 / stefan"
  1577     "Created: / 28-03-2017 / 16:01:45 / stefan"
  2751     RETURN (__MKUCHARACTER(val)) ;
  2753     RETURN (__MKUCHARACTER(val)) ;
  2752 %}
  2754 %}
  2753 
  2755 
  2754     "
  2756     "
  2755      $e asNonDiacritical
  2757      $e asNonDiacritical
  2756      $é asNonDiacritical
  2758      $é asNonDiacritical
  2757      $ä asNonDiacritical
  2759      $ä asNonDiacritical
  2758      $Ã¥ asNonDiacritical
  2760      $å asNonDiacritical
  2759     "
  2761     "
  2760 !
  2762 !
  2761 
  2763 
  2762 isNationalAlphaNumeric
  2764 isNationalAlphaNumeric
  2763     "return true, if the receiver is a letter or digit.
  2765     "return true, if the receiver is a letter or digit.