Попробуйте использовать подстроку и метод indexOf в String:
String str = "http://www.xyz/path1/path2/path3?param1=value1¶m2=value2";
int index = str.indexOf("?");
if (index != -1) {
System.out.println(str.substring(0, str.indexOf("?")));
} else {
System.out.println("You dont have question mark in your url");
}
Многое из того, что вам нужно, уже готово для вас, у вас уже есть обработчики щелчков, поэтому, когда щелкают 0:
blockquote>if (mouseIsPressed && (mouseX > 0 && mouseX < w/5 && mouseY > h1*6.6 && mouseY < h)) { fill(255); } else { fill(0); } }
Что бы я сделал это создание массива для пользовательского ввода, и каждая кнопка, которую пользователь нажимает, просто добавляет ее в массив
let userInput = []; // declared above the setup function .... if (mouseIsPressed && (mouseX > 0 && mouseX < w/5 && mouseY > h1*6.6 && mouseY < h)) { userInput.push(0); // add the nubmer to the array fill(255); } else { fill(0); }
Затем вы можете перебрать этот массив в цикле отрисовки, чтобы вывести его, что-то вроде: [115 ]
let startX = 0; for (let input of userInput) { text(input, startX, 100); startX += 10; }