首页 > 其他分享 >基本操作之——字符截取操作

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

时间:2024-03-05 13:35:08浏览次数:14  
标签:disp 字符 color 截取 dev window 基本操作 String2 String1

*字符截取操作

 


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')

 

标签:disp,字符,color,截取,dev,window,基本操作,String2,String1
From: https://www.cnblogs.com/echo-efun/p/18053828

相关文章

  • 基本操作之——多维空间欧几里得距离距离计算及标量积计算
    dev_clear_window()dev_disp_text('欧几里得距离计算','window',200,200,'black','box_color','#00ffffc0')V1:=[18.8,132.4,33,19.3]dev_disp_text('V1='+V1,'window',220,200,'black',......
  • 基本操作之——正弦函数绘制
    1.周期为2pi正弦函数绘制dev_close_window()dev_open_window(0,0,512,512,'black',WindowID)dev_set_part(0,0,511,511)old_x:=0old_y:=0Rate:=1dev_set_color('red')forx:=1to511by4y:=-sin(x/511.0*2*3.1416*Rate......
  • Oracle拼接字段时,含字符类型拼接会多出空格?
    1.问题如下图所示,当我们在Oracle中使用||拼接字段时,若含字符char类型,会多出一些奇怪的空格,原因和如何解决呢?SELECTVEND_NAME||'('||VEND_COUNTRY||')'FROMVENDORSORDERBYVEND_NAME;2.解决出现这种情况的主要是因为变量的类型为char,因为char类型为固定长度......
  • 基本操作之——位运算
    dev_clear_window()dev_disp_text('数128位左移两位为'+lsh(128,2),'window','center','center','black','box_color','#00ffffc0') dev_clear_window()dev_disp_text('数128位右移两位为'+rsh(12......
  • NOI 1.7.02 找第一个只出现一次的字符
    总时间限制:1000ms内存限制:65536kB描述给定一个只包含小写字母的字符串,请你找到第一个仅出现一次的字符。如果没有,输出no。输入一个字符串,长度小于100000。输出输出第一个仅出现一次的字符,若没有则输出no。样例输入abcabd样例输出c原题链接:http://noi.openjudge.cn......
  • python数据类型与字符串常用方法
    int-py2中有:int/long;py3中有int。-强制转换:int(''76"")-除法:py2(多加一行代码)和py3(正常)boolTrue/False(其他语言:true/false)特殊为False的其他类型:0和""str独有功能upper/lowerreplacestrip/lstrip/rstripisdigitsplit/r......
  • NOI 1.7.01 统计数字字符个数
    总时间限制:1000ms内存限制:65536kB描述输入一行字符,统计出其中数字字符的个数。输入一行字符串,总长度不超过255。输出输出为1行,输出字符串里面数字字符的个数。样例输入PekingUniversityissetupat1898.样例输出4原题链接:http://noi.openjudge.cn/ch0107/01/......
  • c语言进行时——字符串
    字符串定义字符串用的函数......
  • 基础操作之——tuple基本操作
    Tuple1:=[1,2,3,4,5]Number:=|Tuple1|dev_clear_window()dev_disp_text('Tuple1:=[1,2,3,4,5]'+'大小为'+Number,'window','center','center','black','box_color','#00ffffc0')......
  • 基础设置之——字符操作
    --------------整数i:=123操作:1.十进制转八进制dev_clear_window()dev_disp_text('十进制'+i+'转为八进制为'+i$'#o','window','center','center','black','box_color','#00ffffc0') 2.十进制......