Med*_*000 1 string smalltalk visualworks truncation
所以我在一个小谈话中有一个字符串,该字符串作为'$ 100xxxxxxZZ'来到TCP/IP连接,其中x是数字0-9或字母A-Z,ZZ是由发送者计算的校验和.使用字符串我需要计算'100xxxxxx'的校验和,以验证这是正确的消息和校验和.所以我需要能够删除'$ 100xxxxxxZZ'的'$'和'ZZ'
我已经知道如何截断'ZZ',这是我的代码:
ValidateMsg:replyWithCheckSum
Run Code Online (Sandbox Code Playgroud)|newMsg tempMsg| "removes the 'ZZ' from '$100xxxxxxZZ' " tempMsg := replyWithCheckSum copyFrom: 2 to: (replyWithCheckSum size -2). "CODE TO REMOVE THE '$' AND STORE INTO newMsg" "compares the 'ZZ' to the checksum calculated from newMsg" ^(self calcCheckSum: newMsg) = (self getCheckSumFromReply: replyWithCheckSum)
TL; DR如何在visualt 2.5中删除smalltalk中字符串中的第一个字符(是的,我知道这很古老)