Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to Mid()
Message
 
 
À
12/10/2010 12:17:58
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:
01485011
Vues:
30
>>>[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];
>>>
>>
>>We are talking at thousands of MID() which have to be done in a flash. The string is also in the range of 20k. So, I am not sure if this would be any better. This is a highly complex algorythm. The best would be to have the StringBuilder to include a Mid() function. But, this is not supported yet.
>
>Actually, there is http://msdn.microsoft.com/en-us/library/fyx7s61s.aspx
>
>
>string xx = sb.ToString(startIndex, length);
>
>
>You can even make an extension method
>
>
>But why do you need that many mid's ?

Probably to insert tags for reserved words by a different language (e.g format a message using pre tags).
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform