'Check if char array contains any similar char letters (Wordle Clone)
Check if char array contains any similar char letters (Wordle Clone)
How do i use the .contain function to check if an array contains letters from another array in any position. Trying to do a wordle clone.
public static void makeWordString(){
int countGreen =0;
int countRed = 0;
String randWordForString = wordleArrayList.get(rand.nextInt(wordleArrayList.size()));
System.out.println(randWordForString);
char[] arrOfStr = randWordForString.toCharArray();
String newChosenWord = getWordleInput();
char[] arrOfStr1 = newChosenWord.toCharArray();
for(int i=0; i < newChosenWord.length(); i++){
if(arrOfStr[i] == arrOfStr1[i]) {
System.out.print(GREEN_BOLD_BRIGHT + String.valueOf(arrOfStr1[i]) + RESET);
countGreen++;
}
else if(arrOfStr.contains){
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
