So I'm using bubble sort to basically take a string and return it in ascending order of alphabets. It works fine as long as there is not a capital character but if there is a capital character it is automatically placed at the begining. Is there a function I could used to get to ignore capital characters? In case of string I know there is a ignoreCase function but I'm converting the original string to a char array before sorting it, so what do I do in case of chars?
Code:
public class Main {
public static void main(String[] args){
String a = "aome text";
char[] string = a.toCharArray();
int i;
int j;
char temp;
for(i = 0; i < string.length - 1; i++){
for(j = 0; j < string.length - 1; j++){
if (string[j + 1] < string[j]){
temp = string[j + 1];
string[j + 1] = string[j];
string[j] = temp;
}//end if statement
}//end inner loop
}// end outer loop
String output = new String(string);
output = output.trim();
System.out.print(output);
}//end function
}// end class