Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimized way to transfer from String to StringBuilder
Message
De
05/02/2014 13:21:07
 
 
À
05/02/2014 13:16:55
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01593079
Message ID:
01593308
Vues:
27
>>I was just looking at one replace. For a lot:
        Dim lcString As String = "SELECT Member.FirstName,Test.LastName,Member.Bann,Test.Register,User.Blog,Member.Cie,User.NoProvince, Province.Title_E AS Province,Country.Title_E AS Country,Member.City,Member.NoCountry,Member.Http,Member.LastAccess FROM Member(NOLOCK) LEFT JOIN Province ON Member.NoProvince=Province.Numero INNER JOIN Country ON Member.NoCountry=Country.Numero WHERE Member.Numero=@Numero"
>>        Dim lcWords() As String = {"Member", "User", "Test"}
>>
>>        Dim stringBuilder As New StringBuilder(lcString)
>>        For Each s In lcWords
>>            stringBuilder.Replace(s + ".", "[" + s + "].")
>>        Next
>>        Dim result As String = stringBuilder.ToString()
>
>Yes, that was the easy part. The part that I was looking for optimization was the one which deals with Message #1593079

Why were you checking the first and last ?

>and later on I provided a first version of it at Message #1593089. But, that one turned out to be slower. I assume there is a better way to do it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform