-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.4.2" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.1.1" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.4.2" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.4.2" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.4.2" level="project" /> | ||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.7" level="project" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,46 @@ | ||
package com.github.archarithms; | ||
|
||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
public class App | ||
{ | ||
public static String convertToTitleCase(final String inpStr) | ||
{ | ||
return inpStr; | ||
public static String convertToTitleCase(final String inpStr) throws Exception { | ||
if (inpStr == null) { | ||
throw new Exception(); | ||
} | ||
StringBuilder sb = new StringBuilder(); | ||
// Split up the string and remove all of the garbage characters | ||
String[] splitInput = inpStr.split("]|-|_|\\[|/"); | ||
for (int i = 0; i < splitInput.length; i++) { | ||
// Set the entire string to lowercase | ||
String s = splitInput[i].toLowerCase(); | ||
// check to see if the string contains anything | ||
if (s.length() > 0) { | ||
// Set the first letter to Uppercase if possible | ||
String first = s.substring(0, 1).toUpperCase(); | ||
String temp = s.substring(1); | ||
// Concat the 2 strings and append it to the StringBuilder | ||
sb.append(first.concat(temp)); | ||
} | ||
// Append a space to the StringBuilder this isn't the last string | ||
if (i < splitInput.length - 1) { | ||
sb.append(" "); | ||
} | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
public static String convertUnixToDateString(final Long inpUnixSeconds) | ||
{ | ||
return String.valueOf(inpUnixSeconds); | ||
public static String convertUnixToDateString(final Long inpUnixSeconds) throws Exception { | ||
if (inpUnixSeconds == null) { | ||
throw new Exception(); | ||
} | ||
// Convert to milliseconds | ||
Long millis = inpUnixSeconds * 1000; | ||
// Using DateFormat with a Date to make get the correct format | ||
Date date = new Date(millis); | ||
DateFormat format = new SimpleDateFormat("MMMMMMMMM d, y"); | ||
return format.format(date); | ||
} | ||
} |