CharacterArray.st
changeset 24038 917ed6428d22
parent 24037 465ea9b3d20d
child 24041 ffac2cc791c3
equal deleted inserted replaced
24037:465ea9b3d20d 24038:917ed6428d22
    14 "{ Package: 'stx:libbasic' }"
    14 "{ Package: 'stx:libbasic' }"
    15 
    15 
    16 "{ NameSpace: Smalltalk }"
    16 "{ NameSpace: Smalltalk }"
    17 
    17 
    18 UninterpretedBytes variableByteSubclass:#CharacterArray
    18 UninterpretedBytes variableByteSubclass:#CharacterArray
    19 	instanceVariableNames:''
    19         instanceVariableNames:''
    20 	classVariableNames:'DecoderTables DecodingFailedSignal EncoderTables
    20         classVariableNames:'DecoderTables DecodingFailedSignal EncoderTables
    21 		EncodingFailedSignal PreviousMatches UnicodeDenormalizationMap
    21                 EncodingFailedSignal PreviousMatches UnicodeDenormalizationMap
    22 		UnicodeNormalizationMap'
    22                 UnicodeNormalizationMap'
    23 	poolDictionaries:''
    23         poolDictionaries:''
    24 	category:'Collections-Text'
    24         category:'Collections-Text'
    25 !
    25 !
    26 
    26 
    27 !CharacterArray class methodsFor:'documentation'!
    27 !CharacterArray class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
  1625 bindWith:aString
  1625 bindWith:aString
  1626     "return a copy of the receiver, where a '%1' escape is
  1626     "return a copy of the receiver, where a '%1' escape is
  1627      replaced by aString.
  1627      replaced by aString.
  1628      This has been added for VisualAge compatibility."
  1628      This has been added for VisualAge compatibility."
  1629 
  1629 
  1630     ^ self expandPlaceholdersWith:(Array with:aString)
  1630     ^ self expandPlaceholdersWith:{ aString }
  1631 
  1631 
  1632     "
  1632     "
  1633      'do you like %1 ?' bindWith:'smalltalk'
  1633      'do you like %1 ?' bindWith:'smalltalk'
  1634      'do you like %(foo) ?' bindWithArguments:(Dictionary new at:'foo' put:'smalltalk'; yourself)
  1634      'do you like %(foo) ?' bindWithArguments:(Dictionary new at:'foo' put:'smalltalk'; yourself)
  1635     "
  1635     "
       
  1636 
       
  1637     "Modified (format): / 02-04-2019 / 14:05:22 / Claus Gittinger"
  1636 !
  1638 !
  1637 
  1639 
  1638 bindWith:string1 with:string2
  1640 bindWith:string1 with:string2
  1639     "return a copy of the receiver, where a '%1' escape is
  1641     "return a copy of the receiver, where a '%1' escape is
  1640      replaced by string1 and '%2' is replaced by string2.
  1642      replaced by string1 and '%2' is replaced by string2.
  1641      This has been added for VisualAge compatibility."
  1643      This has been added for VisualAge compatibility."
  1642 
  1644 
  1643     ^ self expandPlaceholdersWith:(Array with:string1 with:string2)
  1645     ^ self expandPlaceholdersWith:{string1 . string2}
  1644 
  1646 
  1645     "
  1647     "
  1646      'do you prefer %1 or rather %2 ?'
  1648      'do you prefer %1 or rather %2 ?'
  1647         bindWith:'smalltalk' with:'c++'
  1649         bindWith:'smalltalk' with:'c++'
  1648     "
  1650     "
       
  1651 
       
  1652     "Modified (format): / 02-04-2019 / 14:05:32 / Claus Gittinger"
  1649 !
  1653 !
  1650 
  1654 
  1651 bindWith:str1 with:str2 with:str3
  1655 bindWith:str1 with:str2 with:str3
  1652     "return a copy of the receiver, where a '%1', '%2' and '%3' escapes
  1656     "return a copy of the receiver, where a '%1', '%2' and '%3' escapes
  1653      are replaced by str1, str2 and str3 respectively.
  1657      are replaced by str1, str2 and str3 respectively.
  1654      This has been added for VisualAge compatibility."
  1658      This has been added for VisualAge compatibility."
  1655 
  1659 
  1656     ^ self expandPlaceholdersWith:(Array with:str1 with:str2 with:str3)
  1660     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 }
  1657 
  1661 
  1658     "
  1662     "
  1659      'do you prefer %1 or rather %2 (not talking about %3) ?'
  1663      'do you prefer %1 or rather %2 (not talking about %3) ?'
  1660         bindWith:'smalltalk' with:'c++' with:'c'
  1664         bindWith:'smalltalk' with:'c++' with:'c'
  1661     "
  1665     "
       
  1666 
       
  1667     "Modified (format): / 02-04-2019 / 14:05:45 / Claus Gittinger"
  1662 !
  1668 !
  1663 
  1669 
  1664 bindWith:str1 with:str2 with:str3 with:str4
  1670 bindWith:str1 with:str2 with:str3 with:str4
  1665     "return a copy of the receiver, where a '%1', '%2', '%3' and '%4' escapes
  1671     "return a copy of the receiver, where a '%1', '%2', '%3' and '%4' escapes
  1666      are replaced by str1, str2, str3 and str4 respectively.
  1672      are replaced by str1, str2, str3 and str4 respectively.
  1667      This has been added for VisualAge compatibility."
  1673      This has been added for VisualAge compatibility."
  1668 
  1674 
  1669     ^ self expandPlaceholdersWith:(Array with:str1 with:str2 with:str3 with:str4)
  1675     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 }
  1670 
  1676 
  1671     "
  1677     "
  1672      'do you prefer %1 or rather %2 (not talking about %3 or even %4) ?'
  1678      'do you prefer %1 or rather %2 (not talking about %3 or even %4) ?'
  1673         bindWith:'smalltalk' with:'c++' with:'c' with:'assembler'
  1679         bindWith:'smalltalk' with:'c++' with:'c' with:'assembler'
  1674     "
  1680     "
       
  1681 
       
  1682     "Modified (format): / 02-04-2019 / 14:06:01 / Claus Gittinger"
  1675 !
  1683 !
  1676 
  1684 
  1677 bindWith:str1 with:str2 with:str3 with:str4 with:str5
  1685 bindWith:str1 with:str2 with:str3 with:str4 with:str5
  1678     "return a copy of the receiver, where a '%1' .. '%5' escapes
  1686     "return a copy of the receiver, where a '%1' .. '%5' escapes
  1679      are replaced by str1 .. str5 respectively.
  1687      are replaced by str1 .. str5 respectively.
  1680      This has been added for VisualAge compatibility."
  1688      This has been added for VisualAge compatibility."
  1681 
  1689 
  1682     ^ self expandPlaceholdersWith:(Array with:str1 with:str2 with:str3 with:str4 with:str5)
  1690     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 . str5 }
  1683 
  1691 
  1684     "Created: 31.1.1997 / 16:25:42 / cg"
  1692     "Created: / 31-01-1997 / 16:25:42 / cg"
       
  1693     "Modified: / 02-04-2019 / 14:06:17 / Claus Gittinger"
  1685 !
  1694 !
  1686 
  1695 
  1687 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6
  1696 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6
  1688     "return a copy of the receiver, where a '%1' .. '%6' escapes
  1697     "return a copy of the receiver, where a '%1' .. '%6' escapes
  1689      are replaced by str1 .. str6 respectively.
  1698      are replaced by str1 .. str6 respectively.
  1690      This has been added for VisualAge compatibility."
  1699      This has been added for VisualAge compatibility."
  1691 
  1700 
  1692     ^ self expandPlaceholdersWith:(Array with:str1 with:str2
  1701     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 . str5 . str6 }
  1693                                          with:str3 with:str4
  1702 
  1694                                          with:str5 with:str6)
  1703     "Modified (format): / 02-04-2019 / 14:06:36 / Claus Gittinger"
  1695 !
  1704 !
  1696 
  1705 
  1697 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7
  1706 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7
  1698     "return a copy of the receiver, where a '%1' .. '%7' escapes
  1707     "return a copy of the receiver, where a '%1' .. '%7' escapes
  1699      are replaced by str1 .. str7 respectively.
  1708      are replaced by str1 .. str7 respectively.
  1700      This has been added for VisualAge compatibility."
  1709      This has been added for VisualAge compatibility."
  1701 
  1710 
  1702     ^ self expandPlaceholdersWith:(Array with:str1 with:str2
  1711     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 . str5 . str6 . str7 }
  1703                                          with:str3 with:str4
  1712 
  1704                                          with:str5 with:str6
  1713     "Modified (format): / 02-04-2019 / 14:06:59 / Claus Gittinger"
  1705                                          with:str7)
       
  1706 !
  1714 !
  1707 
  1715 
  1708 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7 with:str8
  1716 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7 with:str8
  1709     "return a copy of the receiver, where a '%1' .. '%8' escapes
  1717     "return a copy of the receiver, where a '%1' .. '%8' escapes
  1710      are replaced by str1 .. str8 respectively.
  1718      are replaced by str1 .. str8 respectively.
  1711      This has been added for VisualAge compatibility."
  1719      This has been added for VisualAge compatibility."
  1712 
  1720 
  1713     ^ self expandPlaceholdersWith:(Array with:str1 with:str2
  1721     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 . str5 . str6 . str7 . str8 }
  1714                                          with:str3 with:str4
       
  1715                                          with:str5 with:str6
       
  1716                                          with:str7 with:str8)
       
  1717 
  1722 
  1718     "Created: / 06-02-2012 / 10:33:18 / cg"
  1723     "Created: / 06-02-2012 / 10:33:18 / cg"
       
  1724     "Modified: / 02-04-2019 / 14:07:15 / Claus Gittinger"
  1719 !
  1725 !
  1720 
  1726 
  1721 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7 with:str8 with:str9
  1727 bindWith:str1 with:str2 with:str3 with:str4 with:str5 with:str6 with:str7 with:str8 with:str9
  1722     "return a copy of the receiver, where a '%1' .. '%9' escapes
  1728     "return a copy of the receiver, where a '%1' .. '%9' escapes
  1723      are replaced by str1 .. str9 respectively.
  1729      are replaced by str1 .. str9 respectively.
  1724      This has been added for VisualAge compatibility."
  1730      This has been added for VisualAge compatibility."
  1725 
  1731 
  1726     ^ self expandPlaceholdersWith:(Array with:str1 with:str2
  1732     ^ self expandPlaceholdersWith:{ str1 . str2 . str3 . str4 . str5 . str6 . str7 . str8 . str9 }
  1727                                          with:str3 with:str4
       
  1728                                          with:str5 with:str6
       
  1729                                          with:str7 with:str8
       
  1730                                          with:str9)
       
  1731 
  1733 
  1732     "Created: / 14-02-2012 / 17:42:31 / cg"
  1734     "Created: / 14-02-2012 / 17:42:31 / cg"
       
  1735     "Modified: / 02-04-2019 / 14:07:35 / Claus Gittinger"
  1733 !
  1736 !
  1734 
  1737 
  1735 bindWithArguments:argumentsCollection
  1738 bindWithArguments:argumentsCollection
  1736     "return a copy of the receiver, where a '%i' escape
  1739     "return a copy of the receiver, where a '%i' escape
  1737      is replaced by the corresponding string from the argument array.
  1740      is replaced by the corresponding string from the argument array.
  1819     "ST80 compatibility - expand '<..>' macros with
  1822     "ST80 compatibility - expand '<..>' macros with
  1820      argument strings. Similar to #bindWith:.
  1823      argument strings. Similar to #bindWith:.
  1821      Read the comment in #expandMacrosWithArguments: about
  1824      Read the comment in #expandMacrosWithArguments: about
  1822      limited compatibility issues."
  1825      limited compatibility issues."
  1823 
  1826 
  1824     ^ self expandMacrosWithArguments:(Array with:arg)
  1827     ^ self expandMacrosWithArguments:{ arg }
  1825 
  1828 
  1826     "Created: / 1.11.1997 / 13:01:28 / cg"
  1829     "Created: / 01-11-1997 / 13:01:28 / cg"
  1827     "Modified: / 1.11.1997 / 13:30:50 / cg"
  1830     "Modified: / 02-04-2019 / 14:09:26 / Claus Gittinger"
  1828 !
  1831 !
  1829 
  1832 
  1830 expandMacrosWith:arg1 with:arg2
  1833 expandMacrosWith:arg1 with:arg2
  1831     "ST80 compatibility - expand '<..>' macros with
  1834     "ST80 compatibility - expand '<..>' macros with
  1832      argument strings. Similar to #bindWith:.
  1835      argument strings. Similar to #bindWith:.
  1833      Read the comment in #expandMacrosWithArguments: about
  1836      Read the comment in #expandMacrosWithArguments: about
  1834      limited compatibility issues."
  1837      limited compatibility issues."
  1835 
  1838 
  1836     ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2)
  1839     ^ self expandMacrosWithArguments:{arg1 . arg2 }
  1837 
  1840 
  1838     "Modified: / 6.7.1998 / 21:58:14 / cg"
  1841     "Modified: / 06-07-1998 / 21:58:14 / cg"
       
  1842     "Modified: / 02-04-2019 / 14:09:36 / Claus Gittinger"
  1839 !
  1843 !
  1840 
  1844 
  1841 expandMacrosWith:arg1 with:arg2 with:arg3
  1845 expandMacrosWith:arg1 with:arg2 with:arg3
  1842     "ST80 compatibility - expand '<..>' macros with
  1846     "ST80 compatibility - expand '<..>' macros with
  1843      argument strings. Similar to #bindWith:.
  1847      argument strings. Similar to #bindWith:.
  1844      Read the comment in #expandMacrosWithArguments: about
  1848      Read the comment in #expandMacrosWithArguments: about
  1845      limited compatibility issues."
  1849      limited compatibility issues."
  1846 
  1850 
  1847     ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2 with:arg3)
  1851     ^ self expandMacrosWithArguments:{ arg1 . arg2 . arg3 }
       
  1852 
       
  1853     "Modified (format): / 02-04-2019 / 14:09:48 / Claus Gittinger"
  1848 !
  1854 !
  1849 
  1855 
  1850 expandMacrosWith:arg1 with:arg2 with:arg3 with:arg4
  1856 expandMacrosWith:arg1 with:arg2 with:arg3 with:arg4
  1851     "ST80 compatibility - expand '<..>' macros with
  1857     "ST80 compatibility - expand '<..>' macros with
  1852      argument strings. Similar to #bindWith:.
  1858      argument strings. Similar to #bindWith:.
  1853      Read the comment in #expandMacrosWithArguments: about
  1859      Read the comment in #expandMacrosWithArguments: about
  1854      limited compatibility issues."
  1860      limited compatibility issues."
  1855 
  1861 
  1856     ^ self expandMacrosWithArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4)
  1862     ^ self expandMacrosWithArguments:{ arg1 . arg2 . arg3 . arg4 }
       
  1863 
       
  1864     "Modified (format): / 02-04-2019 / 14:10:05 / Claus Gittinger"
  1857 !
  1865 !
  1858 
  1866 
  1859 expandMacrosWithArguments:argArray
  1867 expandMacrosWithArguments:argArray
  1860     "ST80 compatibility - expand '<..>' macros with
  1868     "ST80 compatibility - expand '<..>' macros with
  1861      argument strings. Similar to #bindWith:.
  1869      argument strings. Similar to #bindWith:.