本帖最后由 Princess 于 2020-9-21 16:10 编辑
实现对halcon中字母字符串大小写转换,要求是字符串内容必须是字母,否则可能导致失败!原理是参考字符串单字符转ASCII判断后转换!
参数表:
- 签名
- trans_case( : : Tuple, ToLower : TupleOut, Code, Msg)
- 参数
- Tuple (input_control) string → (string) //字母元素组成的Tuple或者字符串变量
- ToLower (input_control) string → (string) //默认为'true'转换成小写,否则使用'false'转换成大写
- Default Value: 'true'
- 建议值: 'true', 'false'
- TupleOut (output_control) string → (string) //成功转换出来的Tuple或者字符串变量
- Code (output_control) any → (tuple) //转换代码,0为成功,其他负数为失败
- Msg (output_control) any → (tuple) //对应上面的错误代码,非0显示错误具体原因
复制代码
调用代码:
- *字母字符串数组
- tup:=['ABCDEFG','HIJKLMN','OPQRST']
- trans_case (tup, 'true', TupleOut, Code, Msg)
- *字母字符串
- str:='ABCDEFGHIJKLMNOPQRST'
- trans_case (str, 'true', TupleOut, Code, Msg)
复制代码
效果图:
外部算子下载:(请自行查找如何加载外部算子)
trans_case.rar
(1.68 KB, 下载次数: 24)
|