You have to choose between char and String, they are different in Java/Processing.
With String:
Code:void setup(){
String word = "aeiou";
String le_1, le_2;
for(int i=1;i<word.length();i++){
le_1 = word.toLowerCase().substring(i-1, i);
le_2 = word.toLowerCase().substring(i, i+1);
print(le_1);
if( le_1.equals("a") ||
le_1.equals("e") ||
le_1.equals("i") ||
le_1.equals("o") ||
le_1.equals("u") ){
if( le_2.equals("a") ||
le_2.equals("e") ||
le_2.equals("i") ||
le_2.equals("o") ||
le_2.equals("u") ){
print("p");
}
}
}
}
Note the change from && to ||, a string can't be equals to several different strings...
With char:
Code:void setup(){
String word = "aeiou";
char le_1, le_2;
for(int i=1;i<word.length();i++){
le_1 = word.toLowerCase().charAt(i-1);
le_2 = word.toLowerCase().charAt(i);
print(le_1);
if ( ( le_1 == 'a' ||
le_1 == 'e' ||
le_1 == 'i' ||
le_1 == 'o' ||
le_1 == 'u' ) &&
( le_2 == 'a' ||
le_2 == 'e' ||
le_2 == 'i' ||
le_2 == 'o' ||
le_2 == 'u' ) )
print("p");
}
}
with a small variant on the logic... Equality test is simpler, too!
I should make a lowercase copy of the string instead of transforming it two times per loop, but here, it isn't important...