can@String @@'文字列を指定文字数に省略する' do abbreviate( max@Integer@>=0'文字数', ellipsis@String@'省略記号' = '...' ) let ellipsis_count = ellipsis.count if(self.count <= ellipsis_count) self.slice(0, max) else self.slice(0, max - ellipsis_count) & ellipsis IF spec '1234567890'.?(7) = '1234...' '1234567890'.?(7, '…') = '123456…' '1234567890'.?(4) = '1...' '1234567890'.?(3) = '123' '1234567890'.?(2) = '12' '1234567890'.?(1) = '1' '1234567890'.?(0) = '' catch?[CompileError] '1234567890'.?(-1) DO CAN