给出方法者给分
解决方案 »
- 关于两个线程休眠的问题
- int i = 012;这怎么解释?
- 大家小年夜快乐!不过还是打扰大家问一个关于java连上数据库的问题
- 请问winxp系统下怎么不能安装jdk1.6?
- 旋转角度得到每旋转一次坐标的方法
- 关于一个字符串的问题
- 问一个比较笨的问题:在JAVA怎么生成可执行程序?
- 求助:JTree的右键菜单linux下就无法出现
- java设置问题
- 高分求解,一个不算难的问题
- 请教一下,这个程序的运行结果是多少?有没有不用上机就可以给出答案来的吗???
- 是不是所有的接口都是public 方法,那么它的实现类也全是public 方法,那么不是任何方法都可以直接调用哪个实现类啊,,,为什么要用接口
这里的字符串都是以逗号隔开,且是有规律的数字,
public class AA {
public static void main(String[] args)
{
String a="1,1075,1046,1085";
String b="1,1046";
System.out.println(a.contains(b.subSequence(1,6)));
}
}
^_^,多查一下文档就可以了!
subSequence
public CharSequence subSequence(int beginIndex,
int endIndex)
Returns a new character sequence that is a subsequence of this sequence.
An invocation of this method of the form str.subSequence(begin, end)
behaves in exactly the same way as the invocation
str.substring(begin, end)
This method is defined so that the String class can implement the CharSequence interface.
Specified by:
subSequence in interface CharSequence
Parameters:
beginIndex - the begin index, inclusive.
endIndex - the end index, exclusive.
Returns:
the specified subsequence.
Throws:
IndexOutOfBoundsException - if beginIndex or endIndex are negative, if endIndex is greater than length(), or if beginIndex is greater than startIndex
Since:
1.4 contains
public boolean contains(CharSequence s)
Returns true if and only if this string contains the specified sequence of char values. Parameters:
s - the sequence to search for
Returns:
true if this string contains s, false otherwise
Throws:
NullPointerException - if s is null
Since:
1.5
boolean bIn=true;
for(int i=0;i<c.length;i++)
{
if(a.indexOf(bIn[i])==-1
{
bIn=false;
break;
}
}
if(bIn)
......
else
......
String[] str=new String[2];
int i=0;
while (b.indexOf(","))
{
str[i]=b.substring(0,b.indexOf(","));
b=b.substring(b.indexOf(",")+1);
i++;
}
for (int j=0;j<str.length() ;j++ )
{
if(a.indexOf(str[j])!=-1)
System.out.println("位置再"+a.indexOf(str[j])); }
String[] str=new String[2];
int i=0;
while (b.indexOf(","))
{
str[i]=b.substring(0,b.indexOf(","));
b=b.substring(b.indexOf(",")+1);
i++;
}
for (int j=0;j<str.length() ;j++ )
{
if(a.indexOf(str[j])!=-1)
System.out.println("位置再"+a.indexOf(str[j])); }