Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to Mid()
Message
De
12/10/2010 14:26:51
 
 
À
12/10/2010 12:58:30
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:
01485064
Vues:
38
>>Sorry, I'm being dense. So you have a piece of text with 16,000-40,000 words. What are you doing with Mid() ?
>
>The number of words is mostly around 2000 to 4000. The 16-40 is about the size of the text such as 20k. Mid() is used to locate a word in the search. Based on it, I then have to apply some parsing.

So you have two strings - one with say 3,000 words and another of about 20K with x words. If the likelihood of words in the 'search for' string not appearing in the 'search in' string is fairly high you could use linq to obtain a list of words that *did* occur and use that as a basis for further manipulation. Something like:
static public List<string> WordsInTarget(string searchFor, string searchIn)
        {
            List<string> s = (from x in searchIn.Split() select x).ToList();
            return (from x in searchFor.Split().Where(x => s.Contains(x)) select x).Distinct().ToList();
        }
No idea how it would compare speed-wise tho. And Split() might need some parameters....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform