-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringUtil.java
More file actions
47 lines (39 loc) · 917 Bytes
/
StringUtil.java
File metadata and controls
47 lines (39 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//Luke Bradaric
public class StringUtil
{
public StringUtil()
{
}
public static String reverseString(String s)
{
int length = s.length();
String front, back;
if(length == 1){
return s;
}else{
front = s.substring(0, 1);
back = s.substring(1);
return reverseString(back) + front;
}
}
public static boolean stringIsPalindrome(String s)
{
String reversed = reverseString(s);
//reversed.toLowerCase();
//reversed.replaceAll("(?:--|[\\[\\]{}()+/\\\\])", "");
if(s.equals(reversed)){
return true;
}else{
return false;
}
}
public static String stringToPiglatin(String s)
{
int length = s.length();
return "e";
}
public static String shorthandString()
{
return "e";
}
}