Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2008 > BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4
This is the forum to discuss the Wrox book Beginning Microsoft Visual C# 2008 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780470191354
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2010, 06:55 PM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default A better example of Chapter 5 Question 6

I have found that using the code from the Downloaded answers can destroy any word that has the no in it such as another would be changed to ayesther. I don't think this would be acceptable but I have a simple cure:

Code on Answer Sheet:

static void Main(string[] args)
{
Console.WriteLine("Enter a string:");
string myString = Console.ReadLine();
myString = myString.Replace("no", "yes");
Console.WriteLine("Replaced \"no\" with \"yes\": {0}", myString);

Preferred code:

static void Main(string[] args)
{
Console.WriteLine("Enter a string with lots of no's");
string myString = Console.ReadLine();
myString = myString.ToLower(); // catch all variations of no
myString = myString.Replace(" no ", " yes "); // note the space before and after no and yes.
Console.WriteLine("I have switched \"no\" with \"yes\" and here is the result\n\n {0}", myString);
Console.ReadKey();
  #2 (permalink)  
Old April 6th, 2010, 08:16 PM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Good stuff!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5 Question jltscaa BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 6 May 18th, 2010 08:39 PM
Chapter 5 Question 5 Will BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 October 24th, 2009 09:18 AM
Question on Chapter 5 arholly BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 September 2nd, 2008 04:07 PM
Chapter 4 question davidle1234 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 18th, 2007 12:18 AM



All times are GMT -4. The time now is 03:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.