Skip to content

Commit d08e956

Browse files
committed
backup
1 parent 2958398 commit d08e956

12 files changed

+208
-1
lines changed

Java/src/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.metadata/

Java/src/RemoveVowels.java

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import java.util.ArrayList;
2+
3+
public class RemoveVowels {
4+
5+
public static String getStringRepresentation(ArrayList<Character> list) {
6+
StringBuilder builder = new StringBuilder(list.size());
7+
for (Character ch : list) {
8+
builder.append(ch);
9+
}
10+
return builder.toString();
11+
}
12+
13+
public static String disemvowel(String str) {
14+
char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
15+
str = str.toLowerCase();
16+
char[] strChars = str.toCharArray();
17+
ArrayList<Character> strCharsList = new ArrayList<Character>();
18+
19+
// add to list when not in vowel.
20+
for (int i = 0; i < strChars.length; i++) {
21+
if (strChars[i] != 'o') {
22+
strCharsList.add(strChars[i]);
23+
}
24+
}
25+
String returnStr = getStringRepresentation(strCharsList);
26+
return returnStr;
27+
}
28+
29+
public static void main(String[] args) {
30+
String s = "This website is for losers LOL!";
31+
System.out.println(disemvowel(s));
32+
}
33+
}

Java/src/RemoveVowelsFromString.java

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import java.util.Arrays;
2+
3+
public class RemoveVowelsFromString {
4+
5+
public static String getString(String s) {
6+
char[] sCharArray = s.toCharArray();
7+
char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
8+
StringBuilder builder = new StringBuilder(sCharArray.length);
9+
10+
for (int i = 0; i < sCharArray.length; i++) {
11+
for (char vowel : vowels) {
12+
if (sCharArray[i] == vowel) {
13+
sCharArray[i] = '0';
14+
}
15+
}
16+
}
17+
18+
for (char ch : sCharArray) {
19+
if (ch != '0') {
20+
builder.append(ch);
21+
}
22+
}
23+
24+
System.out.println(builder);
25+
26+
System.out.print(Arrays.toString(sCharArray));
27+
return "";
28+
}
29+
30+
public static void main(String[] args) {
31+
String s = "This website is for losers LOL!";
32+
getString(s);
33+
}
34+
}

Java/src/TestIn.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
public class TestIn {
3+
4+
public static String removeVowels(char[] letters, String str) {
5+
6+
7+
return "";
8+
}
9+
10+
public static void main(String[] args) {
11+
12+
char[] vowels = {'a', 'e', 'i', 'o', 'u'};
13+
String sentence = "All work and no play makes Jack a dull boy";
14+
}
15+
}

Java/src/codewars/.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

Java/src/codewars/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

Java/src/codewars/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>codewars</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=11
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=11
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import java.util.ArrayList;
2+
3+
public class RemoveVowels {
4+
5+
public static String getStringRepresentation(ArrayList<Character> list) {
6+
StringBuilder builder = new StringBuilder(list.size());
7+
for (Character ch : list) {
8+
builder.append(ch);
9+
}
10+
return builder.toString();
11+
}
12+
13+
public static String disemvowel(String str) {
14+
char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
15+
str = str.toLowerCase();
16+
char[] strChars = str.toCharArray();
17+
ArrayList<Character> strCharsList = new ArrayList<Character>();
18+
19+
// add to list when not in vowel.
20+
for (int i = 0; i < strChars.length; i++) {
21+
if (strChars[i] != 'o') {
22+
strCharsList.add(strChars[i]);
23+
}
24+
}
25+
String returnStr = getStringRepresentation(strCharsList);
26+
return returnStr;
27+
}
28+
29+
public static void main(String[] args) {
30+
String s = "This website is for losers LOL!";
31+
System.out.println(disemvowel(s));
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import java.util.Arrays;
2+
3+
public class RemoveVowelsFromString {
4+
5+
public static String getString(String s) {
6+
char[] sCharArray = s.toCharArray();
7+
char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
8+
StringBuilder builder = new StringBuilder(sCharArray.length);
9+
10+
for (int i = 0; i < sCharArray.length; i++) {
11+
for (char vowel : vowels) {
12+
if (sCharArray[i] == vowel) {
13+
sCharArray[i] = '0';
14+
}
15+
}
16+
}
17+
18+
for (char ch : sCharArray) {
19+
if (ch != '0') {
20+
builder.append(ch);
21+
}
22+
}
23+
24+
System.out.println(builder);
25+
26+
System.out.print(Arrays.toString(sCharArray));
27+
return "";
28+
}
29+
30+
public static void main(String[] args) {
31+
String s = "This website is for losers LOL!";
32+
getString(s);
33+
}
34+
}

Java/src/codewars/src/TestIn.java

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
public class TestIn {
3+
4+
public static String removeVowels(char[] letters, String str) {
5+
6+
7+
return "";
8+
}
9+
10+
public static void main(String[] args) {
11+
12+
char[] vowels = {'a', 'e', 'i', 'o', 'u'};
13+
String sentence = "All work and no play makes Jack a dull boy";
14+
}
15+
}

Python/remove_vowels.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Note: for this kata y isn't considered a vowel.
55
"""
66

7-
string = 'This website is for losers LOL!'
7+
string = 'All work and no play makes Jack a dull boy'
88

99

1010
def remove_vowels(s: str) -> str:

0 commit comments

Comments
 (0)