fix: ReversedString
This commit is contained in:
parent
47bab72ff3
commit
b79fe73ffb
Binary file not shown.
23
FindtheOne/Vowels.java
Normal file
23
FindtheOne/Vowels.java
Normal file
@ -0,0 +1,23 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Vowels {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Please enter your String here: ");
|
||||
String str = sc.nextLine();
|
||||
System.out.println(vowelsFound(str));
|
||||
sc.close();
|
||||
}
|
||||
|
||||
private static boolean vowelsFound(String str) {
|
||||
String vowels = "aeoui";
|
||||
for (char c : str.toLowerCase().toCharArray()) {
|
||||
if (vowels.indexOf(c) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
23
reversedString/ReversedString.java
Normal file
23
reversedString/ReversedString.java
Normal file
@ -0,0 +1,23 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* ReversedString
|
||||
*/
|
||||
public class ReversedString {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Please enter your String:");
|
||||
String str = sc.nextLine();
|
||||
System.out.println(revSTR(str));
|
||||
}
|
||||
|
||||
private static String revSTR(String str) {
|
||||
String revString = "";
|
||||
for (int i = str.length() - 1; i >= 0; i--) {
|
||||
char temp = str.charAt(i);
|
||||
revString += temp;
|
||||
}
|
||||
return revString;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user