加了單引號就是一個常量字符串了,對于每一行都是一樣的
創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站設計、網(wǎng)站制作與策劃設計,靈寶網(wǎng)站建設哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設十余年,網(wǎng)設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:靈寶等地區(qū)。靈寶做網(wǎng)站價格咨詢:18982081108
像這種放在最前面的字段,order by 1 就可以了
如果你是從vb6剛過渡上vb。net,建議還是用冒泡排序法,容易理解。
如果你正努力學習vb。net的方法,推薦一個例子如下:
Imports System
Imports System.Collections
Public Class SamplesArray
Public Class myReverserClass
Implements IComparer
' Calls CaseInsensitiveComparer.Compare with the parameters reversed.
Function Compare(x As Object, y As Object) As Integer _
Implements IComparer.Compare
Return New CaseInsensitiveComparer().Compare(y, x)
End Function 'IComparer.Compare
End Class 'myReverserClass
Public Shared Sub Main()
' Creates and initializes a new Array and a new custom comparer.
Dim myArr As [String]() = {"The", "QUICK", "BROWN", "FOX", "jumps", "over", "the", "lazy", "dog"}
Dim myComparer = New myReverserClass()
' Displays the values of the Array.
Console.WriteLine("The Array initially contains the following values:")
PrintIndexAndValues(myArr)
' Sorts a section of the Array using the default comparer.
Array.Sort(myArr, 1, 3)
Console.WriteLine("After sorting a section of the Array using the default comparer:")
PrintIndexAndValues(myArr)
' Sorts a section of the Array using the reverse case-insensitive comparer.
Array.Sort(myArr, 1, 3, myComparer)
Console.WriteLine("After sorting a section of the Array using the reverse case-insensitive comparer:")
PrintIndexAndValues(myArr)
' Sorts the entire Array using the default comparer.
Array.Sort(myArr)
Console.WriteLine("After sorting the entire Array using the default comparer:")
PrintIndexAndValues(myArr)
' Sorts the entire Array using the reverse case-insensitive comparer.
Array.Sort(myArr, myComparer)
Console.WriteLine("After sorting the entire Array using the reverse case-insensitive comparer:")
PrintIndexAndValues(myArr)
End Sub 'Main
Public Shared Sub PrintIndexAndValues(myArr() As [String])
Dim i As Integer
For i = 0 To myArr.Length - 1
Console.WriteLine(" [{0}] : {1}", i, myArr(i))
Next i
Console.WriteLine()
End Sub 'PrintIndexAndValues
End Class 'SamplesArray
'This code produces the following output.
'
'The Array initially contains the following values:
' [0] : The
' [1] : QUICK
' [2] : BROWN
' [3] : FOX
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting a section of the Array using the default comparer:
' [0] : The
' [1] : BROWN
' [2] : FOX
' [3] : QUICK
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting a section of the Array using the reverse case-insensitive comparer:
' [0] : The
' [1] : QUICK
' [2] : FOX
' [3] : BROWN
' [4] : jumps
' [5] : over
' [6] : the
' [7] : lazy
' [8] : dog
'
'After sorting the entire Array using the default comparer:
' [0] : BROWN
' [1] : dog
' [2] : FOX
' [3] : jumps
' [4] : lazy
' [5] : over
' [6] : QUICK
' [7] : the
' [8] : The
'
'After sorting the entire Array using the reverse case-insensitive comparer:
' [0] : the
' [1] : The
' [2] : QUICK
' [3] : over
' [4] : lazy
' [5] : jumps
' [6] : FOX
' [7] : dog
' [8] : BROWN
游戲中遇到這樣的問題,需要將一組已知的數(shù)據(jù)打亂,按照以前和現(xiàn)在的做法,總結(jié)了以下方法。
方法一,最笨的菜鳥方法,也是容易想到的(幸好我沒想過這種方法 :))
從已知數(shù)組中隨機一個數(shù),然后加入到另一個數(shù)組中,在加入之前,先檢查是否已經(jīng)加入過。
這種方法有很大運氣成分,且數(shù)據(jù)越大,效率越低,超過一定數(shù)目,則程序幾乎無法執(zhí)行,會一直卡在那里,代碼:
[java] view plain copy
package com.test;
import java.util.Random;
public class TestArray {
public static int runCount =0;//用于記錄方法運算次數(shù)