package pl.codegym.task.task15.task1527;
import javax.swing.text.StyledEditorKit;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/*
Parser żądań
*/
public class Solution {
public static void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {String URL = reader.readLine();
char[] list = URL.toCharArray();
String Output = "";
int left = 0;
Object obj = null;
for (int i = 0; i < list.length; i++) {
if (list[i] == '?') {
left = i;
break;
}
}
String podciag = "";
Boolean Podciag = true;
String liczba = "";
for (int i = left + 1; i < list.length; i++) {
try {
if (Podciag = true) {
podciag = null;
podciag += list[i];
podciag += list[i++];
podciag += list[i + 2];
Podciag = false;
}
} catch (Exception e) {
Podciag = false;
}
if (podciag.equals("obj")) {
while (true) {
i++;
if (list[i] == '&') {
break;
} else
liczba += list[i];
}
}
try{
if (list[i] == '&') {
i++;
while(list[i]!='&') {
Output += list[i];
i++;
}
}
}catch(ArrayIndexOutOfBoundsException q){
break;
}
}
System.out.println(Output);
try {
alert(Double.parseDouble(liczba));
} catch (NumberFormatException e) {
alert(liczba);
}
}catch (IOException e) {
}
}
public static void alert ( double value){
System.out.println("double: " + value);
}
public static void alert (String value){
System.out.println("String: " + value);
}
}
Why I can't add chars to String like this : string += 'a' ?
Dyskutowane
Komentarze
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Ta strona nie ma jeszcze żadnych komentarzy