威纶通官方论坛

威纶字符串提取组合

[复制链接]
发表于 2022-3-7 08:29:42 | 显示全部楼层 |阅读模式
怎么处理提取后的高低字节,比如"a,b,c,d,e"  提取后希望是"abcde"  现在是提取后:“a b c d e"
macro_command main()

char a[2]
char b[2]
char c[2]
char d[2]
char e[2]
char h[2]
char i[2]
char j[2]
char k[2]
char q[2]
short ZZQ =1
StringGet(a[0], "Local HMI", LW, 60, 1)
StringGet(b[0], "Local HMI", LW, 61, 1)
StringGet(c[0], "Local HMI", LW, 62, 1)
StringGet(d[0], "Local HMI", LW, 63, 1)
StringGet(e[0], "Local HMI", LW, 64, 1)
StringMid(a[0], ZZQ, h[0])
StringMid(b[0], ZZQ, i[0])
StringMid(c[0], ZZQ, j[0])
StringMid(d[0], ZZQ, k[0])
StringMid(e[0], ZZQ, q[0])

StringSet(h[0], "Local HMI", LW, 70, 1)
StringSet(i[0], "Local HMI", LW, 71 ,1)
StringSet(j[0], "Local HMI", LW, 72, 1)
StringSet(k[0], "Local HMI", LW, 73, 1)
StringSet(q[0], "Local HMI", LW, 74, 1)
end macro_command

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2022-3-8 23:01:46 | 显示全部楼层
macro_command main()
char a[10]="1020304050"
char b[10]
short i,j
SetData(a[0], "Local HMI", RW, 0, 10)

for i=0 to 9 step 2
j=i/2
b[j]=a[i]
next
SetData(b[0], "Local HMI", LW, 0, 10)


end macro_command
发表于 2022-3-8 23:06:29 | 显示全部楼层
macro_command main()
unsigned short  a[5]
char b[10]
short i,j
GetData(a[0], "Local HMI", RW, 0, 5)

for i=0 to 4
LOBYTE(a[i], b[i]) // 提取内容低字节)
next

SetData(b[0], "Local HMI", LW, 0, 10)


end macro_command
您需要登录后才可以发帖 登录 | 注册

本版积分规则

回复帖子

Archiver|小黑屋|威纶通官网 ( 粤ICP备06054553号 )

GMT+8, 2024-11-23 16:22

Powered by Discuz! X3.4

© 2001-2023 Comsenz Inc.

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