网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
判断题
charAt(int index)表示从字符串中取得一个字符,该字符的位置是index
A
对
B
错
参考答案
参考解析
解析:
暂无解析
更多 “判断题charAt(int index)表示从字符串中取得一个字符,该字符的位置是indexA 对B 错” 相关考题
考题
请编写一个函数int pattern_index(char substr[],char str[]),该函数执行含通配符“?”的字符串的查找时,该通配符可以与任一个字符匹配成功。当子串substr在str中匹配查找成功时,返回子串substr在str中的位置,否则返回值为0。要求使用 for循环实现。输出结果如下:子串起始位置:5注意:部分源程序已存在文件test20_2.cpp中。请勿修改主函数main和其他函数中的任何内容,仅在函数pattern_index的花括号中填写若干语句。文件test20_2.cpp的内容如下:include<iostream.h>int pattern_index(char substr[],char str[]){}void main ( ){char *substring,*string;int same;substring="???gram";string="this program return index of substring";same=pattern_index(substring, string);if(same)cout<<"子串起始位置: "<<same<<end1;elsecout<<"匹配不成功" <<end1;}
考题
[说明1]函数void convelt(chal *a,int n)是用递归方法将一个正整数n按逆序存放到一个字符数组a中,例如,n=123,在a中的存放为'3'、'2'、'1'。[C函数1]void convert(char *a,int n){ int i;if((i=n/10)!=0; convert( (1) ,i);*a= (2) ;}[说明2]函数int index(char *s,char *t)检查字符串s中是否包含字符串t,若包含,则返回t在s中的开始位置(下标值),否则返回-1。[C函数2]int index(char *s,char *t){ int i,j=0;k=0;for(i=0;s[i]!:'\0';i++)( for( (3) ;(t[k]!='\0')(s[j]!='\0')( (4) );j++,k++);if( (5) ) return(i);}return(-1);}
考题
( 30 )下列程序的功能是统计字符串中 “ array ” 的个数,在程序的空白处应填入的正确选项是public class FindKey Word s{public static void main(sring[] args){sting text=“ An array is a data structur that stores a collection of ”+ “ values of the same type . You access each individual value ”+ “ through an integer index . For example,if a is an array ”+ “ of inergers, then a[i] is the ith integer in the array. ” ;Int arrayCount =0;Int idex = -1;Sting arrarStr = ” array ” ;Index = text.indexof(arrayStr);While(index______ 0) {++arrayCount;Index += arrayStr.length();Index = text.indexof(arrayStr,index);}System.out.println( “ the text contains ” + arrayCount + “ arrays ” );}}A) B) =C) =D) =
考题
下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。 public class FindKeyWords( public static void main(sring[]args){ sting text= "An array is a data structur that stores a eollection of" +"values of the same type.You access each individu- al value" +"through an integer index.For example.if a is an array" +"of inergers,then all]is the ith integer in the ar- ray."; Int arrayCount=0; Int idex=-l; Sting arrarStr="array": Index=text.indexof(arrayStr); While(index 0){ ++arrayCount: Index+=arrayStr.1ength; Index=text.indexof(arrayStr,index); } System.OUt.println ("the text contains"+arrayCount+"arrays"); } }A.B.=C.=D.=
考题
下列方法中,哪个用于实现获取字符在某个字符串中第一次出现的索引?()
A.char charAt(int index)B.int indexOf(int ch)C.int lastIndexOf(int ch)D.boolean endsWith(String suffix)
考题
函数String(n,"strsdfsdfsdf")的功能是()A、把数值型数据转换为字符串B、返回由n个"s"字符C、从字符串"strsdfsdfsdf")中取出前n个字符D、从字符串中第n个字符的位置开始取子字符串
考题
以下字符串函数的描述中,错误的是()A、charAt函数的作用是返回一个字符,如charAt(1)返回字符串中的第一个字符B、在length函数中,一个汉字占两个英文字母的空间,因此长度也要加倍C、substring函数的作用是返回字符串的一个子串D、String类和StringBuffer类都有length函数,它们的形式和功能是一致的E、indexof函数的作用是从前往后搜索字符第一次出现的位置
考题
StringBufferappend(char[],intint1,intint2)表示()A、向一个字符串追加字符数组,范围从数组的索引int1开始,到索引int2结束B、向一个字符串追加字符数组,范围从数组的索引int1开始,到索引int2-1结束C、向一个字符串追加字符数组,范围从数组的索引int1开始,长度为int2D、向一个字符串追加字符数组,范围从数组的索引int1开始,长度为int2-1
考题
已知字符串:a=“an apple”,b=“other hero”,c=“her”,求: (1)concat(substr(a,1,2),b)。 (2)replace(a,substr(a,5,1),c)。 (3)index(a,c)和index(b,c)。
考题
在JavaScript中,下列关于String对象的charAt()和indexOf()方法理解正确的是()。A、charAt()方法是获取位于指定索引位置的字符B、indexOf()方法是查找字符或字符串的位置,返回字符串出现的所有位置C、charAt()方法的参数可以为一个或两个D、indexOf()方法的参数为指定的索引值
考题
单选题下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。public class FindKeyWords{ public static void main(String[]args) { String text = An array is a data structur that stores a collection of +values of the same type. You access each individual value +through an integer index. For example,if a is an array +of inergers,then a[i] is the ith integer in the array.; int arrayCount=0; int index=-1; String arrayStr=array; index=text.indexOf(arrayCount); while(index ______ 0) { ++arrayCount; index+=arrayStr.length(); index=text.indexOf(arrayStr,index); System.out.println(the text contains+arrayCount+arrays); } }}A
B
=C
=D
=
考题
单选题在JavaScript中,下列关于String对象的charAt()和indexOf()方法理解正确的是()。A
charAt()方法是获取位于指定索引位置的字符B
indexOf()方法是查找字符或字符串的位置,返回字符串出现的所有位置C
charAt()方法的参数可以为一个或两个D
indexOf()方法的参数为指定的索引值
考题
问答题已知字符串:a=“an apple”,b=“other hero”,c=“her”,求: (1)concat(substr(a,1,2),b)。 (2)replace(a,substr(a,5,1),c)。 (3)index(a,c)和index(b,c)。
考题
单选题函数String(n,"strsdfsdfsdf")的功能是()A
把数值型数据转换为字符串B
返回由n个s字符C
从字符串strsdfsdfsdf)中取出前n个字符D
从字符串中第n个字符的位置开始取子字符串
热门标签
最新试卷