returning a little square :s
Hey fellow stack overflowerssss,
I have written;
public class testing
{
public String subString(int start, int end)
{
char[]content = new char[]{0,1,2,3,4,5,6,7,8,9};
String output ="";
for (int i = 0; i < content.length;i++)
{
if (content[i] >= start && content[i] < end)
{
output = output + content[i];
}
}
return output;
}
/**
* @param args
*/
public static void main(String[] args)
{
testing test1 = new testing();
System.out.println( test1.subString(1,2));
}
}
Returns:
[]
It works in a way no matter how I try and split it will return the correct
number of little square. I'm guessing its because I am trying to put an
array element in a string ?
The return needs to be string also.
Can anyone help me out.
P.S I know there is a function for this :)
No comments:
Post a Comment