Android Question How to sorting varible

Discussion in 'Android Questions' started by lamsri799, May 5, 2015.

  1. lamsri799

    lamsri799 Member Licensed User

    example
    I have a variable
    B1 = 20
    B2 = 50
    B3 = 10

    how to sorting variable
    result is
    B3
    B1
    B2

    thank you
     
  2. Mahares

    Mahares Well Known Member Licensed User

    You can add them to a list, then sort the list. See code below:
    Code:
    Dim B1 = 20 As Int
    Dim B2 = 50  As Int
    Dim B3 = 10  As Int
    Dim B() As Int=Array As Int(B1,B2,B3)
    Dim MyList As List 
    MyList.Initialize
    MyList.AddAll(B)
    MyList.Sort(
    True)
    For i=0 To MyList.Size-1
        
    Log(MyList.Get(i))  'displays 10,20,50
    Next
     
    Beja, lamsri799, Erel and 1 other person like this.
  3. lamsri799

    lamsri799 Member Licensed User

    Thank you
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice