C# Fundamentals for Absolute Beginners: (13) Working with Strings

Play C# Fundamentals for Absolute Beginners: (13) Working with Strings
Sign in to queue


Since oftentimes in our applications we'll want to work with string data, this lesson approaches a number of different string manipulations. We look at built-in String methods to manipulate the content inside of a literal string and at the StringBuilder class for concatenating many strings together in a memory and resource-friendly manner.

Full course outline:



Download this episode

The Discussion

  • User profile image
    Austin Elliott

    Thank you so much for these tutorials. :]

  • User profile image

    @Austin Elliott: Thanks Austin.  Hope they're helpful!

  • User profile image

    Bob You are great

  • User profile image

    Hello Bob,

    i know that primitive data types in c# also implemented as classes like the "string" data type. so the outcome of this is that we have 2 classes that can handle strings:

    1. Why we need the String class in addition to the string primitive data type?

    2. in which scenarios one is preferd above the other?

    thank you for making this videos.

    your the best

  • User profile image

    @TheSpecialist: Another great question.  Why do you need the String class in addition to the string primitive.  System.String (capital 'S') is defined in the .NET Framework Common Type System.  C# implements a "short cut" as string (lower-case 's').  Actually, it is the same with *all* primitive types:


    That should explain it.  Good luck!

  • User profile image

    Got it. :)



  • User profile image

    thanks bob. 

  • User profile image

    These Tutorials are AWESOME ... many thanks Bob :)

  • User profile image

    its only small and will probably be covered later on but, in your example for phone numbers, here in the UK pretty much all phone numbers start with a 0,

    in the code below it will drop the 0 of the 5 dig area code and display 1234 567 891

    string.Format("Phone Number {0:(#####) ### ###}",01234567891);

    so my question is how would i display the 0 within my area code, i tried fiddling with it but no joy?

  • User profile image

    If I'm not mistaken, are you a Fall Out Boy fan? That's dope. When I'm already here - great series Bob!

  • User profile image

    @CrazyRandomzZ: Instead of #'s try 0's instead.  See if that works.

    @Victor: Guilty.  :D

  • User profile image
    Ioan Nedelea

    Hi, Bob!

    First I want to thank you for these great tutorials. You did an awesome job. I joined the MVA and took your courses. I ran into a problem though. In the self-assessment on Working With Strings, there's a test question that asks how to format the 123456 => 1,234.56. I have tried string myString = string.Format("{0:#,###.##}", 123456) but it gives me 123.456. Could you please tell me what am I doing wrong? Thank you!

  • User profile image

    Hi, Bob

    First thanks for these videos.
    My questions is how did you separate the line of code into separate lines? About 22:40 in the video.

  • User profile image

    Thanks for the tutorials are good. They could subtitle them in Spanish

  • User profile image
    Dave Herr

    Dear Bob,

    A big thank-you to you and Microsoft for this series. As an "old" Business BASIC programmer-analyst whose job has become too administrative and boring, I've been looking for a way to update my skills and get back into development. I've gone through the VB version of this twice, and am now working through the C# version and have been offered moonlight .NET work with a small tech firm! That and your series are exactly what I needed to start re-inventing my career.

    A couple of questions:

    1) My initial forays into VB and .NET have seemed to focus on the forms or "windows" aspects -something that seems to have minimal treatment in this series. I'm wondering why that is, and where you might point me for more coverage?

    2) How about the Developer Tab in Word or Excel, and macros. Same question as in number 1 I guess.

    Thanks again, and best of the holiday season to you and yours!


  • User profile image
    Mudimba Moonde

    Thanks so much for the tutorials.. They are very helpful

  • User profile image
    Thank you a lot Bob for the videos, i am wanting to make C# my main language and learning as much possible .

Add Your 2 Cents