# Bubble sort text in VB?



## gurutech (Apr 23, 2004)

Can anyone post sample code for how to do a bubble sort of text (string) in VB?

I found this sample in this forum here, but it's in Java, and I don't know enough about Java (or VB for that matter) on how to convert from Java to VB.

```
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
```
Any help is appreciated!!!


----------



## Chicon (Jul 29, 2004)

Hi gurutech,

I've found out a solution of a similar problem on this page.
It's difficult to directly convert programs from Java to VB as both languages hold different 'philosophosy'.


----------



## Nok1 (Feb 16, 2004)

I'll rewrite it for you, just tell me if you're using 6.0 or .NET


----------

