String dotcheck String num String sum check for int num length check S

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
String dotcheck(String num){
String sum="", check;
for(int i=0; i<num.length(); i++){
check=String.valueOf(num.charAt(i));
if(check.equals(",")){check="."; }
sum+=check;
}
return sum; }
Vector lineAnalyzer(String number){
String [] operator=new String[number.length()/2];
String[] numbers=new String[number.length()/2];
String sum, nums;
int n=-1;
for(int i=0; i<number.length(); i++){
nums=String.valueOf(number.charAt(i));
if((nums.equals("*")) || (nums.equals("/")) || (nums.equals("+")) || (nums.equals("-")) || (nums.equals("=")))
{
++n;
numbers[n]=dotcheck(sum);
operator[n]=nums;
sum="";
}
else
{
sum+=nums;
}
}//end for
Vector v=new Vector();
v.addElement(numbers);
v.addElement(operator);
return v;
}