Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Working with Strings - 12

Embed code for this video

Copy the code above to embed our video on your website/blog.

Close

Video format

Option selected may change based on video formats available and browser capability.

Close

Download

Right click “Save as…”

Like strings, dates and times are represented using special types, and so deserve some attention. In this lesson we learn how to work with Date and Time data, how to create new instances of DateTime, how to add time, format the data for display, and more. Furthermore, we discuss the TimeSpan class as a means of representing a duration of time.

 

Download the source code for Working with Strings

Tags:

Follow the Discussion

  • Rob CadeRob Cade

    Great videos - we're recommending them to our students. Thanks.

    Those are BACK-slashes, though, aren't they?

    Rob

  • Rob GRob G

    I'm really enjoying learning from this series. Very well presented.

    I'd just like to point out that the description and link on this page refer to the next video.

  • @Rob ... Oops .. let's hope that's my ONLY mistake.  Wink

  • ArwenArwen

    Just to point out, the description of this video is the same as video 13. It doesn't really apply to video 12.

    On another note, great video!

  • Naqi AghaNaqi Agha

    Sir in this series do have you covered the complete concepts of object oriented programming too?? Like the tutorial on www.learnvisualstudio.com??

  • @Arwen: Thanks for the heads up ... I'll make sure the good folks at Channel9 see this issue.  Thanks again!

    @Naqi Agha: Object Oriented Programming (beyond the absolute basics) was NOT covered in this Channel9 Fundamentals series.  I do talk about classes, properties, methods, and inheritance in this series, but I don't really address the OOP thought process here.  Sorry, it just wasn't in the scope of what the Channel9 team was looking for.

  • Thennarasanthens #(: Known is a Drop, UnKnown is an Ocean :)#

    @BobTabor: Hi Bob, Won't we get intellisense inside the formatting string for currency, numeric and etc, after pressing the semicolon like {0: ? 

  • Jose RobertoJose Roberto

    Hello Bob,
    the link of code of lesson 12 target to code of lesson 13.

  • Hi Bob,

    I love your style and I can easily follow you. These videos are excellent especially for a beginner like me in C#. Can you kindly direct me to a lesson which will teach me how to read html tables from a webpage and then use these numbers in further calculations. Does a string become a number?

    Thxs

    J

  • @thens: Probably so ... Intellisense should guide you (even if it didn't show up in the video I created ... ??)

    @Jose Roberto: Unfortunately that's not something I can fix ... you will need to get Microsoft's attention by clicking the Feedback link in the Footer of this site so they can repair the links.  Thanks for the heads up.  Smiley

    @jake123: Thanks for the kind words ... I don't have a free lesson on scraping a website, but I know there are a bunch of articles out there on the web that describe the technique.  It definitely can be done.  Search for terms like "web page scraping C#" or the like.  Best wishes!

  • billbill

    When I download the source code I get Date and Times not Strings??

  • @bill: Thanks, that is something Microsoft / Channel 9 will need to fix.  I'll bring that to their attention.  Thank you again.

  • Golnazgolnazal HEY HEY HEY

    the source code should be fixed. thanks for letting me know.

  • KratiKrati

    http://blogs.msdn.com/b/csharpfaq/archieve/2004/03/12/88415.aspx

    is not acessible

  • KratiKrati

    is there a way to trim the spaces in between words?
    say "hello world"

  • @Krati: Bummer ... I hate when that happens.  Try searching in your favorite search engine for the keywords ... I'm sure they just moved it somewhere new.

    re: Spaces in between words ... there are probably several ways to accomplish this.  I'm not in a code editor, but you would do something like this (syntax might be off a bit):

    var myNewString = myOldString.Replace("  ", " ");

    Note ... I would send in the "bad" string (with two spaces between double-quotes) as the first parameter, and the "good"string (with one space between double-quotes).

    If you need to be more selective, you might need to turn the entire string into a char array and loop through every character in the string looking for a sequence that fits the criteria you need.  That would allow for a pretty advanced case, but would be code intensive.  Hope that helps!

  • Raviteja varmaRaviteja varma

    it is my pleasure writing you,really your video lectures helped me a lot.thanks a lot.

  • Thanks Bob for This lesson...I learn somethings.

     

  • sebastiaan hilberssebastiaan hilbers

    Wow this is helping me learn c# so much. I am coming from PHP and recognizing alot of similarities.

  • RyanRyan

    Hah, funny. If for whatever reason you want 2 backward slashes you'd have to type c:\\\\. If you just input 3, you get the squiggly line.

  • RasikaRasika

    Thanks a lot Bob,This is helping me a lot :)

  • This series is a lot of help. Thank you and your team.

     

  • The below code is not working for me.

    
    StringBuilder myString = new StringBuilder();
    for (int i = 0; i < 50; i++)
    {
    myString = myString +"--"+i.ToString();
    }
    


    Getting below error:
    Cannot implicitly convert type 'string' to 'System.Text.StringBuilder'

  • http://msdn.microsoft.com/en-us/library/system.string.aspx

  • VarunVarun

    Hi Bob,

    I am a beginner and find your videos extremely informative and helpful.
    I have a doubt regarding the way while loop functions, how is the while function able to move onto the next line in the txt file with out us telling it to. I mean in the for loop we have to increment the value everytime the loop finishes and so it moves on to the next.

  • YunusYunus

    Thanks a lot for your valuable tutorials!

  • RamisatRamisat

    @Jonagesh, you appear to have written wrong. You should have it like below:

    StringBuilder myString = new StringBuilder();
    for(int i = 0; i < 50; i++)
    {
    myString.Append("--");
    myString.Append(i);
    }

  • LyxLyx

    Bob, thanks for the great tutorials for C#, very helpful for beginners like me.

    For some reasons, VS 2010 accepts both

    myString = String.Format("Length Before: {0} -- After: {1}", myString.Length, myString.Trim().Length);

    and

    myString = string.Format("Length Before: {0} -- After: {1}", myString.Length, myString.Trim().Length);

    (the String.Format in the first line of code is in block letter S; the string.Format in the second line of code is in small letter s)

    However, VS2012 only accepts the second line of code. I also notice that string and String are interchangeable sometimes.

  • So the string formatting isn't just for string values...... That is confusing considering numbers, phone numbers and currency aren't string values.

Remove this comment

Remove this thread

close

Comment on the Post

Already have a Channel 9 account? Please sign in