我正在使用此函數來反轉文本,但我有一個小問題的速度。 進行測試我有130,000個字符的文本,大約需要10秒。是否有可能加快速度?這個問題是不是C#不同,因爲它是一個vb.net加速函數反轉字符串
Function ReverseString(ByRef strString As String) As String
Dim NextChr, TempString As String, StringLength, Count As Integer, NewString As String = Nothing
TempString = strString
StringLength = Len(TempString)
Do While Count <= StringLength
Count = Count + 1
NextChr = Mid(TempString, Count, 1)
NewString = NextChr & NewString
Loop
ReverseString = NewString
End Function
Linq「Reverse」怎麼辦? – tuespetre
這個問題呢[使用線程反向字符串](http://stackoverflow.com/questions/10573286/reversing-a-string-using-threads)?可以幫助嗎? –
更適合[codereview stackexchange](http://codereview.stackexchange.com/)? – ethorn10