Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to Mid()
Message
De
12/10/2010 02:23:00
 
 
À
12/10/2010 02:14:48
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:
01484803
Message ID:
01484924
Vues:
49
>>Mid() doesn't perform very well if you have a string at 20k. I have been looking since the last hour at an alternative using StringBuilder to achieve the same but was unable to find something valuable. Has anyone had to deal with long string when using Mid()?
>
>[I have not installed vs2010 on my new computer yet - so I cannot test]
>
>If you use a lot of mid() it will be slow. The reason is - I think - that each call creates another string (object)
>
>Can you use one char at a time ? If yes, why not index the string
>
>char c ;
>string s = "very long string";
>
>c = s[5];
>


If you are using the Mid() to continue the search for the next match, you can use IndexOf() and specify the startIndex

http://msdn.microsoft.com/en-us/library/aa904287(v=VS.71).aspx
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform