基本操作之——字符截取操作

*字符截取操作

 


String1 := 'abcdefghij'
String2 := '0123456'
Message := '字符截取操作'
Message[1] := 'String1 := \'abcdefghij\''
Message[2] := 'String2 := \'0123456\''
dev_clear_window()
dev_disp_text(Message, 'window', 0, 0, 'white', 'box_color', '#00ffff4c')

tuple_substr (String1, 3, 5, SingleSubstring1)
dev_disp_text('tuple_substr (String1, 3, 5, SingleSubstring1)执行结果为'+SingleSubstring1, 'window', 50, 0, 'white', 'box_color', '#00ffff4c')

SingleSubstring2 := String1{3:5}
dev_disp_text('SingleSubstring2 := String1{3:5}执行结果为'+SingleSubstring2, 'window', 70, 0, 'white', 'box_color', '#00ffff4c')


tuple_substr (String1, [1,2,3], [3,6,3], MultipleIndices1)
SingleSubstring2 := String1{3:5}
dev_disp_text('tuple_substr (String1, [1,2,3], [3,6,3], MultipleIndices1)执行结果为'+MultipleIndices1, 'window', 90, 0, 'white', 'box_color', '#00ffff4c')

MultipleIndices2 := String1{[1,2,3]:[3,6,3]}
dev_disp_text('MultipleIndices2 := String1{[1,2,3]:[3,6,3]}执行结果为'+MultipleIndices2, 'window', 150, 0, 'white', 'box_color', '#00ffff4c')


tuple_substr ([String1,String2], 3, 5, MultipleInputStrings1)
dev_disp_text('tuple_substr ([String1,String2], 3, 5, MultipleInputStrings1)执行结果为'+MultipleInputStrings1, 'window', 210, 0, 'white', 'box_color', '#00ffff4c')

 

MultipleInputStrings2 := [String1,String2]{3:5}
dev_disp_text('MultipleInputStrings2 := [String1,String2]{3:5}执行结果为'+MultipleInputStrings2, 'window', 250, 0, 'white', 'box_color', '#00ffff4c')


tuple_substr ([String1,String2], [5,0], [8,1], MultipleInputStringsAndIndices1)
dev_disp_text('tuple_substr ([String1,String2], [5,0], [8,1], MultipleInputStringsAndIndices1)执行结果为'+MultipleInputStringsAndIndices1, 'window', 310, 0, 'white', 'box_color', '#00ffff4c')

MultipleInputStringsAndIndices2 := [String1,String2]{[5,0]:[8,1]}
dev_disp_text('MultipleInputStringsAndIndices2 := [String1,String2]{[5,0]:[8,1]}执行结果为'+MultipleInputStringsAndIndices2, 'window', 350, 0, 'white', 'box_color', '#00ffff4c')


tuple_substr ([String1,String2], 1, 0, EmptySubstring1)
dev_disp_text('tuple_substr ([String1,String2], 1, 0, EmptySubstring1)执行结果为'+EmptySubstring1, 'window', 390, 0, 'white', 'box_color', '#00ffff4c')


EmptySubstring2 := [String1,String2]{1:0}
dev_disp_text('EmptySubstring2 := [String1,String2]{1:0}执行结果为'+EmptySubstring2, 'window', 430, 0, 'white', 'box_color', '#00ffff4c')

 

posted @   echo-efun  阅读(19)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示