Hey folks, I made the changes Lisa recommended. Still does not work.
package de.codegym.task.task15.task1527;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Parser anfordern
*/
public class Solution {
public static void main(String[] args)throws IOException{
//schreib hier deinen Code
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String url = reader.readLine();
int j = url.length();
int start = url.indexOf('?')+1;
String newurl = url.substring(start);
ArrayList<String> list = new ArrayList<>();
String s = newurl;
//int x = 10;
while(true){
//System.out.println(newurl);
if(s.indexOf('&')==-1){list.add(s);break;}
//System.out.println(s.indexOf('&'));
// x--;if(x==1)break;
int drei = s.indexOf('&');
String t = s.substring(0,drei);
list.add(t);
String g = s.substring(drei+1);
//System.out.println("g "+g);
//System.out.println(t);
s = g;
}
ArrayList<Object> dolist = new ArrayList<>();
for(String wort : list){
if(wort.indexOf('=')!=-1){
if(wort.indexOf('.')!=-1){int i = wort.indexOf('=');
String neu = wort.substring(i+1);
String neupara =wort.substring(0,i);
int h = list.indexOf(wort);
list.set(h,neupara);
dolist.add(neu);
}
else { int i = wort.indexOf('=');
String neu =wort.substring(0,i);
int h = list.indexOf(wort);
list.set(h,neu);
//neu
dolist.add(wort.substring(i+1));
}
}
}
for(String str : list){
System.out.print(str+" ");
}
System.out.println("");
for(Object d : dolist){
try{Integer g = Integer.parseInt((String)d);alert((String)d);}
catch(Exception f) { try{double b = Double.parseDouble((String)d);alert(b);}catch(Exception e){
alert((String) d);
}}
}
}
public static void alert(double value) {
System.out.println("double: " + value);
}
public static void alert(String value) {
System.out.println("String: " + value);
}
}