Add tags

Add tags to the following comment
Squeak Smalltalk では、文字単位の置換には #replaceAll:with: を、文字列の置換には #copyReplaceAll:with: を使います。なお、前者は破壊的です。

後者に似た状況で、しかし一致するトークンのみを置き換えたい場合向けに #copyReplaceTokens:with: が用意されています。

これらで対処できない全置換を行なうには手続き的に書く必要があります。
1
2
3
4
5
6
7
8
'song so fit' replaceAll: $s with: $t
"=> 'tong to fit' "

'How now brown cow?' copyReplaceAll: 'ow' with: 'ello'
"=> 'Hello nello brellon cello?' "

'File asFile Files File''s File' copyReplaceTokens: 'File' with: 'Snick'
"=> 'Snick asFile Files Snick''s Snick' "

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...