开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 4539|回复: 3
收起左侧

[已解决] 精易模块8.0.0文本_均分文本()bug

[复制链接]
结帖率:100% (1/1)
发表于 2020-1-25 22:14:38 | 显示全部楼层 |阅读模式   广西壮族自治区钦州市
模块中使用文本_均分文本()命令时,当文本过长时无法均分,会将文本全部堆至结果数组最后一位。
如:

文本_均分文本 (#xx, tmp2文本型数组, 10)

.计次循环首 (取数组成员数 (tmp2文本型数组), tmp1整数型)
    调试输出 (tmp2文本型数组 [tmp1整数型])
.计次循环尾 ()


输出:

* “”
* “”
* “”
* “”
* “”
* “”
* “”
* “”
* “”
* “{46,215,211,179,204,208,242,32,83,101,116,66,105,110,44,32,44,32,185,171,191,170,44,32,214,195,215,214,189,218,188,175,13,10,46,178,206,202,253,32,116,44,32,215,214,189,218,188,175,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,116,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,66,121,116,101,44,32,44,32,185,171,191,170,44,32,214,195,215,214,189,218,13,10,46,178,206,202,253,32,98,44,32,215,214,189,218,208,205,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,66,121,116,101,50,66,105,110,32,40,98,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,68,97,116,97,44,32,44,32,185,171,191,170,44,32,214,195,192,224,202,253,190,221,13,10,46,178,206,202,253,32,98,105,110,44,32,215,214,189,218,188,175,13,10,13,10,109,95,98,105,110,32,163,189,32,98,105,110,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,73,110,116,44,32,44,32,185,171,191,170,44,32,214,195,213,251,202,253,13,10,46,178,206,202,253,32,105,110,116,44,32,213,251,202,253,208,205,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,73,110,116,50,66,105,110,32,40,105,110,116,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,83,104,111,114,116,44,32,44,32,185,171,191,170,44,32,214,195,182,204,213,251,202,253,13,10,46,178,206,202,253,32,115,104,111,114,116,44,32,182,204,213,251,202,253,208,205,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,83,104,111,114,116,50,66,105,110,32,40,115,104,111,114,116,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,76,111,110,103,44,32,44,32,185,171,191,170,13,10,46,178,206,202,253,32,108,111,110,103,44,32,179,164,213,251,202,253,208,205,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,76,111,110,103,50,66,105,110,32,40,108,111,110,103,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,83,116,114,44,32,44,32,185,171,191,170,13,10,46,178,206,202,253,32,116,44,32,206,196,177,190,208,205,13,10,13,10,109,95,98,105,110,32,163,189,32,109,95,98,105,110,32,163,171,32,181,189,215,214,189,218,188,175,32,40,116,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,76,101,110,83,116,114,44,32,44,32,185,171,191,170,13,10,46,178,206,202,253,32,116,44,32,206,196,177,190,208,205,13,10,13,10,83,101,116,84,111,107,101,110,32,40,181,189,215,214,189,218,188,175,32,40,116,41,41,13,10,13,10,46,215,211,179,204,208,242,32,83,101,116,84,111,107,101,110,44,32,44,32,185,171,191,170,44,32,214,195,193,238,197,198,13,10,46,178,206,202,253,32,116,44,32,215,214,189,218,188,175,13,10,13,10,83,101,116,83,104,111,114,116,32,40,181,189,182,204,213,251,202,253,32,40,200,161,215,214,189,218,188,175,179,164,182,200,32,40,116,41,41,41,13,10,83,101,116,66,105,110,32,40,116,41,13,10,46,176,230,177,190,32,50,13,10,13,10,46,179,204,208,242,188,175,32,207,251,207,162,189,226,206,246,44,32,44,32,185,171,191,170,13,10,46,179,204,208,242,188,175,177,228,193,191,32,207,251,207,162,182,212,193,208,177,237,44,32,202,253,95,207,251,207,162,189,226,206,246,44,32,44,32,34,48,34,13,10,13,10,46,215,211,179,204,208,242,32,95,179,245,202,188,187,175,44,32,44,32,44,32,181,177,187,249,211,218,177,190,192,224,181,196,182,212,207,243,177,187,180,180,189,168,186,243,163,172,180,203,183,189,183,168,187,225,177,187,215,212,182,175,181,247,211,195,13,10,13,10,13,10,13,10,46,215,211,179,204,208,242,32,95,207,250,187,217,44,32,44,32,44,32,181,177,187,249,211,218,177,190,192,224,181,196,182,212,207,243,177,187,207,250,187,217,199,176,163,172,180,203,183,189,183,168,187,225,177,187,215,212,182,175,181,247,211,195,13,10,13,10,13,10,13,10,46,215,211,179,204,208,242,32,199,229,191,213,44,32,44,32,185,171,191,170,13,10,13,10,199,229,179,253,202,253,215,233,32,40,207,251,207,162,182,212,193,208,177,237,41,13,10,13,10,46,215,211,179,204,208,242,32,208,180,200,235,44,32,194,223,188,173,208,205,44,32,185,171,191,170,13,10,46,178,206,202,253,32,207,251,207,162,180,174,44,32,206,196,177,190,208,205,13,10,46,190,214,178,191,177,228,193,191,32,212,173,202,253,190,221,44,32,215,214,189,218,188,175,13,10,46,190,214,178,191,177,228,193,191,32,193,217,202,177,202,253,190,221,44,32,215,214,189,218,188,175,13,10,46,190,214,178,191,177,228,193,191,32,193,217,202,177,207,251,207,162,189,226,206,246,44,32,202,253,95,207,251,207,162,189,226,206,246,13,10,46,190,214,178,191,177,228,193,191,32,117,44,32,85,110,112,97,99,107,13,10,46,190,214,178,191,177,228,193,191,32,117,50,44,32,85,110,112,97,99,107,13,10,46,190,214,178,191,177,228,193,191,32,105,44,32,213,251,202,253,208,205,13,10,46,190,214,178,191,177,228,193,191,32,99,111,117,110,116,44,32,213,251,202,253,208,205,13,10,13,10,212,173,202,253,190,221,32,163,189,32,66,97,115,101,54,52,189,226,194,235,32,40,207,251,207,162,180,174,41,13,10,46,200,231,185,251,213,230,32,40,200,161,215,214,189,218,188,175,179,164,182,200,32,40,212,173,202,253,190,221,41,32,163,188,32,52,41,13,10,32,32,32,32,183,181,187,216,32,40,188,217,41,13,10,46,200,231,185,251,213,230,189,225,202,248,13,10,117,46,83,101,116,68,97,116,97,32,40,212,173,202,253,190,221,41,13,10,99,111,117,110,116,32,163,189,32,117,46,71,101,116,73,110,116,32,40,41,13,10,46,200,231,185,251,213,230,32,40,99,111,117,110,116,32,163,188,32,48,41,13,10,32,32,32,32,183,181,187,216,32,40,188,217,41,13,10,46,200,231,185,251,213,230,189,225,202,248,13,10,46,188,198,180,206,209,173,187,183,202,215,32,40,99,111,117,110,116,44,32,105,41,13,10,32,32,32,32,193,217,202,177,202,253,190,221,32,163,189,32,117,46,71,101,116,84,111,107,101,110,32,40,41,13,10,32,32,32,32,46,200,231,185,251,213,230,32,40,200,161,215,214,189,218,188,175,179,164,182,200,32,40,193,217,202,177,202,253,190,221,41,32,163,188,32,52,41,13,10,32,32,32,32,32,32,32,32,199,229,179,253,202,253,215,233,32,40,207,251,207,162,182,212,193,208,177,237,41,13,10,32,32,32,32,32,32,32,32,183,181,187,216,32,40,188,217,41,13,10,32,32,32,32,46,200,231,185,251,213,230,189,225,202,248,13,10,32,32,32,32,117,50,46,83,101,116,68,97,116,97,32,40,193,217,202,177,202,253,190,221,41,13,10,32,32,32,32,193,217,202,177,207,251,207,162,189,226,206,246,46,107,101,121,32,163,189,32,117,50,46,71,101,116,76,101,110,83,116,114,32,40,41,13,10,32,32,32,32,193,217,202,177,207,251,207,162,189,226,206,246,46,196,218,200,221,32,163,189,32,117,50,46,71,101,116,76,101,110,83,116,114,32,40,41,13,10,32,32,32,32,188,211,200,235,179,201,212,177,32,40,207,251,207,162,182,212,193,208,177,237,44,32,193,217,202,177,207,251,207,162,189,226,206,246,41,13,10,46,188,198,180,206,209,173,187,183,206,178,32,40,41,13,10,183,181,187,216,32,40,213,230,41,13,10,13,10,46,215,211,179,204,208,242,32,204,237,188,211,181,165,184,246,44,32,44,32,185,171,191,170,13,10,46,178,206,202,253,32,107,101,121,44,32,206,196,177,190,208,205,13,10,46,178,206,202,253,32,196,218,200,221,44,32,206,196,177,190,208,205,13,10,46,190,214,178,191,177,228,193,191,32,105,44,32,213,251,202,253,208,205,13,10,46,190,214,178,191,177,228,193,191,32,193,217,202,177,44,32,202,253,95,207,251,207,162,189,226,206,246,13,10,13,10,46,188,198,180,206,209,173,187,183,202,215,32,40,200,161,202,253,215,233,179,201,212,177,202,253,32,40,207,251,207,162,182,212,193,208,177,237,41,44,32,105,41,13,10,32,32,32,32,46,200,231,185,251,213,230,32,40,207,251,207,162,182,212,193,208,177,237,32,91,105,93,46,107,101,121,32,163,189,32,107,101,121,41,13,10,32,32,32,32,32,32,32,32,207,251,207,162,182,212,193,208,177,237,32,91,105,93,46,196,218,200,221,32,163,189,32,196,218,200,221,13,10,32,32,32,32,32,32,32,32,183,181,187,216,32,40,41,13,10,32,32,32,32,46,200,231,185,251,213,230,189,225,202,248,13,10,13,10,46,188,198,180,206,209,173,187,183,206,178,32,40,41,13,10,193,217,202,177,46,107,101,121,32,163,189,32,107,101,121,13,10,193,217,202,177,46,196,218,200,221,32,163,189,32,196,218,200,221,13,10,188,211,200,235,179,201,212,177,32,40,207,251,207,162,182,212,193,208,177,237,44,32,193,217,202,177,41,13,10,13,10,46,215,211,179,204,208,242,32,182,193,200,161,44,32,206,196,177,190,208,205,44,32,185,171,191,170,13,10}”

发表于 2020-1-26 03:35:05 | 显示全部楼层   新加坡
本帖最后由 xynmb 于 2020-1-26 03:41 编辑

闲着无聊  来个还算完美的代码吧
2020-1-26 3-41-5.png 2020-1-26 3-34-39.png
  
子程序名返回值类型公开备 注
文本_均分文本ex整数型 
参数名类 型参考可空数组备 注
参_内容字节集要处理的文本内容
参_均分分隔符字节集
参_保留分隔符逻辑型
参_文本数组字节集用于存放返回文本的数组
参_分割数整数型分割的段数
变量名类 型静态数组备 注
局_内容字节集 
局_区间值整数型 
局_偏移整数型 
局_区间倍数整数型 
局_已经分割次数整数型 
局_保留长度整数型 
局_本次内容字节集 
清除数组 (参_文本数组)
局_内容 = 参_内容
如果真 (是否为空 (参_均分分隔符))
参_均分分隔符 = 到字节集 ( #换行符 )
局_区间值 = 四舍五入 (取字节集长度 (局_内容) ÷ 参_分割数, )
如果真 (参_保留分隔符)
局_保留长度 = 取字节集长度 (参_均分分隔符)
局_区间倍数 = 1
判断循环首 (局_已经分割次数 < 参_分割数)
局_偏移 = 倒找字节集 (局_内容, 参_均分分隔符, 局_区间值 × 局_区间倍数)
如果真 (局_偏移 = -1)
如果真 (局_区间值 × 局_区间倍数 > 取字节集长度 (局_内容))
跳出循环 ()
局_区间倍数 = 局_区间倍数 + 1
到循环尾 ()
局_区间倍数 = 1
判断 (参_保留分隔符)
局_本次内容 = 取字节集中间 (局_内容, 1, 局_偏移 + 局_保留长度 - 1)
局_本次内容 = 取字节集中间 (局_内容, 1, 局_偏移 - 1)
加入成员 (参_文本数组, 局_本次内容)
判断 (参_保留分隔符)
局_内容 = 取字节集右边 (局_内容, 取字节集长度 (局_内容) - 局_偏移 - 局_保留长度 + 1)
局_内容 = 取字节集右边 (局_内容, 取字节集长度 (局_内容) - 局_偏移 + 局_保留长度 - 1)
如果真 (局_内容 = {  })
跳出循环 ()
局_已经分割次数 = 局_已经分割次数 + 1
如果真 (局_已经分割次数 + 1 = 参_分割数)
跳出循环 ()

判断循环尾 ()
如果真 (局_内容 ≠ {  })
加入成员 (参_文本数组, 局_内容)
返回 (取数组成员数 (参_文本数组))


回复 支持 反对

使用道具 举报

发表于 2020-1-26 02:46:44 | 显示全部楼层   新加坡
是bug也不是bug  看源码就知道  
因为文本有单字节 或者双字节 所以 代码根据 换行符来判断的
先取长度 /分段数 得到每段文本的大小
为了保证xx的 完整 开始倒找 换行符 没有就是-1 取不到 字节集中间
这个命令 本身没多少实用性 建议根据自己的情况来写一个
回复 支持 反对

使用道具 举报

结帖率:75% (3/4)
发表于 2020-1-26 02:44:48 | 显示全部楼层   广东省东莞市
感觉一般人没有这样的需求吧
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表