Wrox Programmer Forums
|
BOOK: Beginning Microsoft Visual Basic 2010
This is the forum to discuss the Wrox book Beginning Visual Basic 2010 by Thearon Willis, Bryan Newsome; ISBN: 9780470502228
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2012, 12:08 AM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 2 Times in 2 Posts
Smile Count words improved with regex ch7

The count words in chapter seven about page 208 is too simple because every time you key a space the word count goes up. The authors mention that this code is kind of bogus but do not say how it can be improved. Anywho, this snippet works much better than the one in the book. Paste it in the function CountWords to check it out. Just comment the original lines.

Code:
 Dim my_word_array() As String = System.Text.RegularExpressions. _
                                               Regex.Split(text, "\W+")

        return my_word_array.Length
The Following User Says Thank You to Silas Tomkyn Combermache For This Useful Post:
DwayneB (February 18th, 2012)





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to count words in pdf document + php + source code ravihj PHP How-To 0 July 16th, 2009 05:58 AM
'how to count words in pdf document + php + source code' ravihj PHP How-To 0 July 16th, 2009 05:57 AM
Count the number of words in a PDF document basil123 Pro PHP 5 May 27th, 2009 01:00 AM
Is there an Improved Datagrid? computer_user C# 3 October 15th, 2004 03:25 PM
Count the number of words in a PDF document. basil123 PHP How-To 0 October 16th, 2003 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.