Skip to content

Commit

Permalink
feat(string/Vocab): add 'string'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiMuhIbnuHibbanBagoesMalolo committed Nov 17, 2021
1 parent 0800fbe commit 7530672
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions src/main/java/ip/syssrc/string/Vocab.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Assignment 5.2
*
* @author H071171512 - Fitrah Muhammad <fitrahm17h@student.unhas.ac.id>
* @author H071211060 - Andi Muh. Ibnu Hibban Bagoes Malolo <andibagoes1412@gmail.com>
*
*/
public class Vocab {
Expand All @@ -17,7 +17,8 @@ public class Vocab {
* @return string of prefixes word
*/
public static String addPrefixUn(String word) {
return new String();
word = "Un" + word;
return new String(word);
}

/**
Expand All @@ -29,7 +30,15 @@ public static String addPrefixUn(String word) {
* `prefix :: prefixword_1 :: prefixword_2 :: ... :: prefixword_n`
*/
public static String prefixes(String prefix, String... groups) {
return new String();
String uni = new String(prefix + "::");

for (int i = 0; i < groups.length; i++) {
groups[i] = prefix.concat(groups[i]);
}

uni += String.join("::", groups);

return new String(uni);
}

/**
Expand All @@ -39,7 +48,14 @@ public static String prefixes(String prefix, String... groups) {
* @return string of word without 'ness' suffix
*/
public static String removeSuffixNess(String word) {
return new String();
if (word.endsWith("ness")) {
word = word.replace("ness", "");

if (word.endsWith("i")) {
word = word.replace("i", "y");
}
}
return new String(word);
}

/**
Expand All @@ -51,6 +67,20 @@ public static String removeSuffixNess(String word) {
* @return string of extracted adjective as a verb
*/
public static String nounToVerb(String sentence, int index) {
return new String();
String[] dum = sentence.split(" ");

if (index == -1) {
index = dum.length - 1;
}

String dom = new String(dum[index]);

if(dom.endsWith(".")){
dom = dom.replace(".", "");
}

dom = dom.concat("en");

return new String(dom);
}
}

0 comments on commit 7530672

Please sign in to comment.