package com.github.qrokodial.sparkle.utilities.characters;

public class StringUtils {
    /**
     * Checks to see if a string starts with another string in a case-insensitive manner.
     *
     * @param haystack the main string
     * @param needle the string to test against the main string
     * @return true if it matches, false otherwise
     */
    public static boolean startsWithIgnoreCase(String haystack, String needle) {
        if (needle.length() > haystack.length()) {
            return false;
        }

        for (int i = 0; i < needle.length(); i++) {
            if (!haystack.substring(i, i + 1).equalsIgnoreCase(needle.substring(i, i + 1))) {
                return false;
            }
        }

        return true;
    }

    /**
     * Checks to see if a string ends with another string in a case-insensitive manner.
     *
     * @param haystack the main string
     * @param needle the string to test against the main string
     * @return true if it matches, false otherwise
     */
    public static boolean endsWithIgnoreCase(String haystack, String needle) {
        if (needle.length() > haystack.length()) {
            return false;
        }

        for (int i = 0; i < needle.length(); i++) {
            int start = haystack.length() - needle.length() + i;
            if (!haystack.substring(start, start + 1).equalsIgnoreCase(needle.substring(i, i + 1))) {
                return false;
            }
        }

        return true;
    }
}

@@ -53,16 +53,68 @@
 cters;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 public c
@@ -1529,11 +1529,1423 @@
 e;%0A    %7D
+%0A%0A    /**%0A     * Parses an array of string arguments so that things wrapped in quotes count as one element in the array.%0A     *%0A     * @param arguments the arguments to sanitize%0A     * @param delimiter the delimiter to insert in between the elements in quotes (ie: %22 %22)%0A     * @return the sanitized array of string arguments%0A     */%0A    public static String%5B%5D parseArguments(String%5B%5D arguments, String delimiter) %7B%0A        List%3CString%3E sanitized = new ArrayList%3C%3E();%0A%0A        for (int i = 0; i %3C arguments.length; i++) %7B%0A            if (arguments%5Bi%5D.startsWith(%22%5C%22%22)) %7B%0A                StringBuilder buffer = new StringBuilder();%0A                buffer.append(arguments%5Bi%5D.substring(%22%5C%22%22.length()));%0A%0A                for (; i %3C arguments.length; i++) %7B%0A                    buffer.append(arguments%5Bi%5D);%0A%0A                    if (arguments%5Bi%5D.endsWith(%22%5C%22%22)) %7B%0A                        buffer.append(arguments%5Bi%5D.substring(0, arguments%5Bi%5D.length() - %22%5C%22%22.length()));%0A                        buffer.append(delimiter);%0A                        break;%0A                    %7D else %7B%0A                        buffer.append(arguments%5Bi%5D);%0A                        buffer.append(delimiter);%0A                    %7D%0A                %7D%0A%0A                sanitized.add(buffer.toString());%0A            %7D else %7B%0A                sanitized.add(arguments%5Bi%5D);%0A            %7D%0A        %7D%0A%0A        return sanitized.toArray(new String%5B0%5D);%0A    %7D
 %0A%7D%0A

add StringUtils#parseArguments