Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 9566|回复: 5

skill中判断字符串中是否包含某个字符的函数

[复制链接]
发表于 2015-8-28 12:08:25 | 显示全部楼层 |阅读模式
有没有字符串的函数,能够判断字符串中是否包含某一个字符,或者包含这种字符有多少个呢?类似“abcdea”里面有“a”两个,能够判断出来么?
发表于 2015-8-28 17:31:19 | 显示全部楼层
  1. Skill > a = "ababddfabadgha"
  2. "ababddfabadgha"
  3. Skill > b = parseString(a "")
  4. ("a" "b" "a" "b" "d"
  5.     "d" "f" "a" "b" "a"
  6.     "d" "g" "h" "a"
  7. )
  8. Skill > c = 0
  9. 0
  10. Skill > foreach(i b when(i == "a" c = c +1 ))
  11. ("a" "b" "a" "b" "d"
  12.     "d" "f" "a" "b" "a"
  13.     "d" "g" "h" "a"
  14. )
  15. Skill > axlUIWPrint(nil "Total "a" : %d" c)
  16. Total "a" : 5
  17. t
复制代码
 楼主| 发表于 2015-8-29 09:57:39 | 显示全部楼层

非常感谢版主,我想再请教一个问题,最近在进行cadence交互的操作就是主程序和子程序通讯,通过ipcReadProcess不停的读取子程序发来的数据,如下所示:
cid=ipcBeginProcess("e:/SchCheck.exe" "" nil nil nil "")
                while( t
                       buf = ipcReadProcess(cid 2)
                       printf("read: %s",buf)
           )
子程序是C编写的代码不停的通过printf+fflush(stdout)发送字符串,发现运行一小段时间以后,skill就挂死了,不再出现打印,然后又过大概一分钟又把之前的全部都打印出来了,如果挂死器件,强制关闭skill的对话框,会打印如下:
请问这是什么原因呢,很棘手呀?
捕获.JPG
发表于 2015-8-30 10:45:34 | 显示全部楼层
  1. Skill > a = "ababddfabadgha"
  2. "ababddfabadgha"
  3. Skill > b = parseString(a "")
  4. ("a" "b" "a" "b" "d"
  5.     "d" "f" "a" "b" "a"
  6.     "d" "g" "h" "a"
  7. )
  8. Skill > lTemp = setof(x b (x == "a"))
  9. ("a" "a" "a" "a" "a")
  10. Skill > axlUIWPrint(nil "Total "a" : %d" length(lTemp))
  11. Total "a" : 5
  12. t
  13. Skill >
复制代码
发表于 2020-1-31 17:24:49 | 显示全部楼层
1233445555
发表于 2020-10-23 11:36:57 | 显示全部楼层
exists(m klList (m == "xxxx"))
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|网站地图|Cadence Skill 论坛 ( 蜀ICP备13024417号 )

GMT+8, 2024-4-25 19:57 , Processed in 0.148199 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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