Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert VFP class to C# class Help (Arrays)
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01373708
Message ID:
01373754
Views:
12
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform