如何将长字符串拆分为"包裹"字符串?

Max*_*tly 0 delphi string

如何在Delphi中执行此操作?

我有一个很长的字符串.我需要每隔5个字母包装sting并在包装字符串的末尾添加一个点.

示例字符串:

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Run Code Online (Sandbox Code Playgroud)

结果:

sssss. 
sssss. 
sssss. 
sssss.
Run Code Online (Sandbox Code Playgroud)

War*_* P 7

你的老师可能希望你学习足够多的pascal来写这样的东西:

 loop through the characters in the string
   get a character from the string and add it to another string
   check if five letters have gone by, and if so, 
      add a dot and a carriage-return-and-linefeed character.
 end loop
Run Code Online (Sandbox Code Playgroud)

  • +1正确回答作业问题.(这个问题询问如何做一些基本的事情,而不发布他们尝试过的代码不起作用.)干得好,@ Warren! (2认同)