1 / 13

C Soup To Nuts: Part 11: Creating and Manipulating Strings

What We Will Cover. StringsWorking with StringsStringBuilder class. Strings. A simple series of charactersstring s =

malise
Download Presentation

C Soup To Nuts: Part 11: Creating and Manipulating Strings

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. C# Soup To Nuts: Part 11: Creating and Manipulating Strings William J. Steele MSDN Developer Evangelist Microsoft Corporation http://blogs.msdn.com/wsteele

    2. What We Will Cover Strings Working with Strings StringBuilder class

    3. Strings A simple series of characters string s = “Hello, World!”; Strings can be “added” together s = “Hello, ” + “World!”; Strings are Immutable Once created, can not be changed New strings are created instead

    4. Demonstration One Building Strings

    5. Working With Strings Adding strings s += “New Text”; Parsing Strings s.Substring(2, 5); Escape Characters \n = new line \t = tab \\ = backslash @ Symbol s = @”\\literal charcters\n\t\\”;

    6. Additional String Methods SubString() Parse string Repalce() Replace part of string with new text Split() Split string into multiple strings based on char Trim() Remove extraneous spaces ToUpper() and ToLower() Change Case Of Text

    7. Demonstration Two Working With Strings

    8. StringBuilder Class String Concatenation Builds New Strings StringBuilder builds buffer first StringBuilder sb = new StringBuilder(); sb.Append(“Hello, “); sb.Append(“World!”); string s = sb.ToString();

    9. Demonstration Three StringBuilder class

    10. Summary Strings Working with Strings StringBuilder class

    11. Next Week: Exception Handling Microsoft® Visual C#® .NET is the newest programming language from Microsoft. So far in this series, we've been exploring the basics of C# and Microsoft® Visual C# 2005 Express Edition. In this webcast we will examine specific C# language features. We will learn how handles unexpected problems with our application via the robust Exception Handling system built into the .NET Framework. We will learn about Try-Catch blocks and how to correctly handle the different types of exceptions that your application can experience.

    12. Thank You! My contact information: William J. Steele wsteele@microsoft.com http://blogs.msdn.com/wsteele My manager is Melanie Brunner Send feedback to mbrunne@microsoft.com

    13. Questions and Answers Submit text questions using the “Ask” button. Don’t forget to fill out the survey. For upcoming and previously live webcasts: www.microsoft.com/webcasts Got webcast content ideas? Contact us at: http://go.microsoft.com/fwlink/?LinkId=41781 Today's webcast was presented using Microsoft® Office Live Meeting. Get a free 14-day trial by visiting: www.microsoft.com/presentlive 

More Related