Initial Commit
This commit is contained in:
1 parent
6072663bc0
commit
15e09fc78d
8 files changed
+105
No files matched your search
BIN
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Eobard</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
package eobard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class Eobard {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String stringToReverse = JOptionPane.showInputDialog(null, "String To Reverse:");
|
||||
|
||||
String result = stringReverser(stringToReverse).toString();
|
||||
|
||||
JOptionPane.showMessageDialog(null, result);
|
||||
|
||||
}
|
||||
|
||||
public static String stringReverser(String stringMessenger) {
|
||||
|
||||
List<Character> stringReverserList = new ArrayList<>();
|
||||
|
||||
for(int i = stringMessenger.length() - 1; i > -1; i--) {
|
||||
stringReverserList.add(stringMessenger.charAt(i));
|
||||
}
|
||||
for(int i = 0; i < stringReverserList.size(); i++) {
|
||||
stringMessenger += stringReverserList.get(i);
|
||||
}
|
||||
stringMessenger = stringMessenger.substring((stringMessenger.length() / 2), stringMessenger.length());
|
||||
|
||||
return stringMessenger;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +1,37 @@
|
||||
# Eobard
|
||||
Java application that reverses any given text. Built for practice.
|
||||
|
||||
This task can be done in half the lines and much less complexity by using the "StringBuilder" calss, but I wanted to build it on my own to get un-rusty from basic Java, so the only thing I allowed myself to use was basic programmatic operations and ArrayList.
|
||||
|
||||
Screenshots:
|
||||
|
||||
i.imgur.com/aGiGjwJ.png
|
||||
|
||||
i.imgur.com/aG123cc.png
|
||||
|
||||
To run:
|
||||
|
||||
1. Download .jar
|
||||
2. Open shell
|
||||
3. cd to download directory
|
||||
4. Type "java -jar Eobard.jar"
|
||||
5. Profit?
|
||||
|
||||
|
||||
Below is a much simpler way to do this. Enjoy:
|
||||
|
||||
================================================
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class TestingGrounds {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String stringToReverse = JOptionPane.showInputDialog(null, "String To Reverse:");
|
||||
|
||||
JOptionPane.showMessageDialog(null, new StringBuilder(stringToReverse).reverse().toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user