Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimized way to transfer from String to StringBuilder
Message
 
À
03/02/2014 23:11:03
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:
01593353
Vues:
55
This message has been marked as a message which has helped to the initial question of the thread.
If those are the only two strings you're dealing with in the block before the string is complete and then used, then you don't need a string builder. StringBuilder starts being more efficient around 6-8 concatenations but before that it's not going to matter much.

Unless you're running this code in a loop - don't bother with a string builder.

+++ Rick ---

>The following code is executed intensively:
>
>
>            ' Check for the last occurence
>            If Mid(lcString, lcString.Length - lcWord.Length) = "." + lcWord Then
>                lcString = Mid(lcString, 1, lcString.Length - lcWord.Length) + "[" + lcWord + "] "
>            End If
>
>            ' Check for the first occurence
>            If Mid(lcString, 1, lcWord.Length + 1) = lcWord + "." Then
>                lcString = "[" + Mid(lcString, 1, lcWord.Length) + "]" + Mid(lcString, lcWord.Length + 1)
>            End If
>
>
>Now, in order to fit some very long string, I have adjusted that method to use a StringBuilder instead.
>
>So, just before that code, instead of lcString, I have a loStringBuilder. This is the last part remaining in the conversion of that method. I am looking for the best way to convert that.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform