Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert VFP class to C# class Help (Arrays)
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01373708
Message ID:
01373754
Vues:
19
>>Do you know if there is an equiv to GETWORDCOUNT in c#?
>
>Not that I know of. However, you could use one of the overloads of .Split() and split on a space. Not sure if that will do a good enough job or not - you could use regular expressions, or .Replace() along with .Split() - use replace to convert returns or line feeds to spaces, for example.

Sorry, forgot to mention that you'd then use .Length to get the length of the string.

Actually, you could probably eliminate Replace() in most cases by splitting on it.
string sampleString = "This is a sample.";
string[] items = sampleString.Split(new char[] {' ', '\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);int count = items.Length;
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform