Created
May 5, 2016 18:04
-
-
Save dante-byte/85f8d8a4fec2c8f2633d5fe1fac1bcf7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tiy; | |
/** | |
* Created by Donta White on 4/30/2016. | |
*/ | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
import java.io.*; | |
public class JavaConvention { | |
public static void main(String[] args) { | |
ArrayList<String> forSplits = new ArrayList<String>(); | |
for (int counter = 0; counter < 100; counter++) { | |
System.out.println("please enter a string"); | |
Scanner lineScanner = new Scanner(System.in); | |
String myInput = lineScanner.nextLine(); | |
System.out.println("choose how you would like to see your string, below are your options "); | |
System.out.println("(1)variable"); | |
System.out.println("(2)method"); | |
System.out.println("(3)class"); | |
String newInput = lineScanner.nextLine(); | |
if (newInput.equals("1")) { | |
String[] myInputTwo = myInput.split(" "); | |
String finalString = ""; | |
//String firstLetter = myInputTwo[0].substring(0,1).toLowerCase(); <-- Does the same thing as the next line | |
String firstLetter = myInputTwo[0].substring(0, 1).toLowerCase(); | |
String restOfFirstWord = myInputTwo[0].substring(1).toLowerCase(); | |
finalString += (firstLetter + restOfFirstWord); | |
for (int count = 1; count < myInputTwo.length; count++) { | |
String firstLetterNextWord = myInputTwo[count].substring(0, 1).toUpperCase(); | |
String restOfNextWord = myInputTwo[count].substring(1).toLowerCase(); | |
finalString = finalString + firstLetterNextWord + restOfNextWord; | |
} | |
System.out.println(finalString); | |
} | |
if (newInput.equals("2")) { | |
String[] myInputTwo = myInput.split(" "); | |
String finalString = ""; | |
String firstLetter = myInputTwo[0].substring(0, 1).toLowerCase(); | |
String restOfFirstWord = myInputTwo[0].substring(1).toLowerCase(); | |
finalString += (firstLetter + restOfFirstWord); | |
for (int count = 1; count < myInputTwo.length; count++) { | |
String firstLetterNextWord = myInputTwo[count].substring(0, 1).toUpperCase(); | |
String restOfNextWord = myInputTwo[count].substring(1).toLowerCase(); | |
finalString = finalString + firstLetterNextWord + restOfNextWord; | |
} | |
System.out.println(finalString + "()"); | |
} | |
if (newInput.equals("3")) { | |
String[] myInputTwo = myInput.split(" "); | |
String finalString = ""; | |
String firstLetter = myInputTwo[0].substring(0, 1).toUpperCase(); | |
String restOfFirstWord = myInputTwo[0].substring(1).toLowerCase(); | |
finalString += (firstLetter + restOfFirstWord); | |
for (int count = 1; count < myInputTwo.length; count++) { | |
String firstLetterNextWord = myInputTwo[count].substring(0, 1).toUpperCase(); | |
String restOfNextWord = myInputTwo[count].substring(1).toLowerCase(); | |
finalString = finalString + firstLetterNextWord + restOfNextWord; | |
} | |
System.out.println(finalString + "{}"); | |
} | |
} | |
} | |
public static void substring(){ | |
} | |
public static void split(){ | |
System.out.println(" just testing two "); | |
} | |
public static void toUpperCase(){ | |
String Abc = new String("This is a test"); | |
System.out.println(Abc.toUpperCase()); | |
} | |
public static void toLowerCase(){ | |
String Abc = new String("This is a test"); | |
System.out.println(Abc.toLowerCase()); | |
} | |
public static void length(){ | |
String abc = new String("This is o a test"); | |
System.out.println(abc.length()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tiy; | |
/** | |
* Created by Donta White on 4/30/2016. | |
*/ | |
public class StringReverser { | |
public static void main(String[] args) { | |
//String userString = "Something"; | |
//char[] stringCharacters = userString.toCharArray(); | |
//System.out.println(""); | |
} | |
public static void myReverse(){ | |
String s1 = "donta"; | |
for(int i=s1.length()-1;i>=0;i--) | |
{ | |
System.out.print(s1.charAt(i)); | |
} | |
} | |
public static void myReverseTwo(){} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment