Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gebes committed May 12, 2020
1 parent 0285e35 commit 490272f
Show file tree
Hide file tree
Showing 15 changed files with 250 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/project-template.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# StringToUnicodeConverter

Simple Converter made in Java

## How to use
1. Download the release and execute the run.bat (on Windows)

###or

1. Clone the repo
2. Compile it on your own

## What did I learn?
* How to convert numbers to Hex
12 changes: 12 additions & 0 deletions StringToUnicodeConverter.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions src/eu/gebes/writingBot/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package eu.gebes.writingBot;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Unicode unicode = new Unicode();

unicode.execute();


}
}
52 changes: 52 additions & 0 deletions src/eu/gebes/writingBot/Unicode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package eu.gebes.writingBot;

import java.util.Scanner;

public class Unicode {

static class Converter {
public String charToUnicodeString(char c) {
final String unicode = Integer.toHexString(c).toUpperCase();
return "U+" + ("0".repeat(4 - unicode.length())) + unicode;
}
}

public void execute() {

Converter converter = new Converter();

printHeader();
printLinebreak();

boolean exit = false;
while (!exit) {

System.out.print(" Enter a String to convert in Unicode or press enter to exit\n > ");
String input = new Scanner(System.in).nextLine();


if (input.isEmpty()) {
input = "Bye";
exit = true;
}

for (char c : input.toCharArray())
System.out.println("\t" + c + ": " + converter.charToUnicodeString(c));

printLinebreak();

}
}

private void printHeader() {
System.out.println();
System.out.println("\tUnicodeConverter");
System.out.println("\t\tv1.0");
System.out.println();
}

private void printLinebreak() {
System.out.println("-" + "=-".repeat(48));
}

}

0 comments on commit 490272f

Please sign in to comment.