CharacterArray.st
branchjv
changeset 18084 ab5b38bd8f81
parent 18077 5844a3bcdd52
parent 15628 4fe28df5850d
child 18086 33a050555eb1
equal deleted inserted replaced
18083:5558dc303721 18084:ab5b38bd8f81
  1640     "Created: 2.4.1997 / 17:23:26 / cg"
  1640     "Created: 2.4.1997 / 17:23:26 / cg"
  1641 !
  1641 !
  1642 
  1642 
  1643 indexOfControlCharacterStartingAt:startIndex
  1643 indexOfControlCharacterStartingAt:startIndex
  1644     "return the index of the next control character;
  1644     "return the index of the next control character;
  1645      starting the search at startIndex, searching forward;
       
  1646      that is a character with asciiValue < 32.
  1645      that is a character with asciiValue < 32.
       
  1646      Start the search at startIndex, searching forward.
  1647      Return 0 if none is found."
  1647      Return 0 if none is found."
  1648 
  1648 
  1649     |start  "{ Class: SmallInteger }"
  1649     |start  "{ Class: SmallInteger }"
  1650      mySize "{ Class: SmallInteger }"|
  1650      mySize "{ Class: SmallInteger }"|
  1651 
  1651 
  1652     start := startIndex.
  1652     start := startIndex.
  1653     mySize := self size.
  1653     mySize := self size.
  1654 
  1654 
  1655     start to:mySize do:[:index |
  1655     start to:mySize do:[:index |
  1656 	(self at:index) isControlCharacter ifTrue:[^ index]
  1656         (self at:index) isControlCharacter ifTrue:[^ index]
  1657     ].
  1657     ].
  1658     ^ 0
  1658     ^ 0
  1659 
  1659 
  1660     "
  1660     "
  1661      'hello world' asTwoByteString            indexOfControlCharacterStartingAt:1
  1661      'hello world' asTwoByteString            indexOfControlCharacterStartingAt:1
  5568 
  5568 
  5569     "Modified: / 18.7.1998 / 22:53:08 / cg"
  5569     "Modified: / 18.7.1998 / 22:53:08 / cg"
  5570 !
  5570 !
  5571 
  5571 
  5572 withoutCEscapes
  5572 withoutCEscapes
  5573     "return a new string consisting of receivers characters
  5573     "return a new string consisting of receiver's characters
  5574      with all \X-character escapes replaced by corresponding-characters.
  5574      with all \X-character escapes replaced by corresponding-characters.
  5575      (similar to the way C-language Strings are converted).
  5575      (similar to the way C-language Strings are converted).
  5576      The following escapes are supported:
  5576      The following escapes are supported:
  5577         \r      return character
  5577         \r      return character
  5578         \n      newline character
  5578         \n      newline character
  6410 ! !
  6410 ! !
  6411 
  6411 
  6412 !CharacterArray class methodsFor:'documentation'!
  6412 !CharacterArray class methodsFor:'documentation'!
  6413 
  6413 
  6414 version
  6414 version
  6415     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.508 2013-07-23 17:21:14 cg Exp $'
  6415     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.510 2013-08-13 17:31:00 cg Exp $'
  6416 !
  6416 !
  6417 
  6417 
  6418 version_CVS
  6418 version_CVS
  6419     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.508 2013-07-23 17:21:14 cg Exp $'
  6419     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.510 2013-08-13 17:31:00 cg Exp $'
  6420 !
  6420 !
  6421 
  6421 
  6422 version_HG
  6422 version_HG
  6423 
  6423 
  6424     ^ '$Changeset: <not expanded> $'
  6424     ^ '$Changeset: <not expanded> $'