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

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

Description

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:

Embed

Download

Download this episode

The Discussion

  • User profile image
    Austin Elliott

    Thank you so much for these tutorials. :]

  • User profile image
    BobTabor

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

  • User profile image
    Ayaz

    Bob You are great

  • User profile image
    The​Specialist

    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
    BobTabor

    @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:

    https://msdn.microsoft.com/en-us/library/ya5y69ds.aspx

    That should explain it.  Good luck!

  • User profile image
    The​Specialist

    Got it. :)

    Thank's

     

  • User profile image
    maum2201

    thanks bob. 

  • User profile image
    LeeScane

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

  • User profile image
    CrazyRandomz​Z

    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
    Victor

    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
    BobTabor

    @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
    Shawn

    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
    Joel

    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!

    -Dave

  • User profile image
    Mudimba Moonde

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

  • User profile image
    richik500
    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