Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StringHelper {
- private String str;
- public StringHelper() {
- }
- public static String meshStrings(String str1, String str2) {
- String mesh_str = "";
- for(int i = 0; i < str1.length(); i++) {
- mesh_str += str1.charAt(i);
- if (str2.length() > i) {
- mesh_str += str2.charAt(i);
- }
- }
- if (str2.length() > str1.length()) {
- mesh_str += str2.substring(str1.length());
- }
- return mesh_str;
- }
- public static String replaceVowelsWithOodle(String str) {
- String new_str = "";
- for(int i = 0; i < str.length(); i++) {
- char c = str.charAt(i);
- if (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U' ) {
- new_str += "oodle";
- } else {
- new_str += c;
- }
- }
- return new_str;
- }
- public static double weight(String str) {
- double weight = 0.0;
- for (int i = 0; i < str.length(); i ++) {
- char c = str.charAt(i);
- if (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U' ) {
- weight += 2.5;
- } else {
- weight += 3.4;
- }
- }
- return weight;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement