Regex for converting xml tags key to camel case

Try something like this:

public void tagToCamelCase(String input){
    char[] inputArray = input.toCharArray();
        for (int i = 0; i < inputArray.length-2; i++){
            if (inputArray[i] == '<'){
                if(inputArray[i+1]!= "https://stackoverflow.com/")
                    inputArray[i+1] = Character.toLowerCase(inputArray[i+1]);
                else
                    inputArray[i+2] = Character.toLowerCase(inputArray[i+2]);
            }
        }
        System.out.println(new String(inputArray));
}

Note: the tag ID will be iD and not id. Hope this helps.

Leave a Comment