-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDubstep.java
More file actions
26 lines (26 loc) · 738 Bytes
/
Dubstep.java
File metadata and controls
26 lines (26 loc) · 738 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
/**
* Created by Lukas on 2017-02-08.
*/
public class Dubstep {
public static String SongDecoder (String song)
{
StringBuilder e = new StringBuilder(song);
int index = e.indexOf("WUB");
while (index != -1){
if (index != 0 && index != -1 && e.charAt(index - 1) != ' '){
e.insert(index, ' ');
e.delete(index + 1, index + 4);
}
else
e.delete(index, index + 3);
index = e.indexOf("WUB");
}
return e.toString().replaceAll("\\s+$", "");
}
}
//public class Dubstep {
// public static String SongDecoder (String song)
// {
// return song.replaceAll("(WUB)+", " ").trim();
// }
//}