Sign In | Subscribe

Enter your Sign on user name and password.

Forgot password?
  • Follow us on:
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of C#
  • Discussion

  • Study Guides

  • Table of Contents

Lecture Comments (4)

1 answer

Last reply by: John Snape
Thu Apr 24, 2014 3:15 AM

Post by Timothy Davis on April 23, 2014

Hi Professor Snape, I am enjoying the videos so far. Some of what you are teaching I already know because I am a Computer Science major, and  a lot  I dont know. I am working on a project for school, and it requires me to parse a line to look for information, and then use that information. Is there a method to search a string for x amount of characters, and then do something with a word located at a certain position in that string?

1 answer

Last reply by: John Snape
Fri Apr 18, 2014 11:04 PM

Post by Thuy Nguyen on April 18, 2014

Hi Prof Snape,

For the String.Join method, what is the 0, 4 when you wrote

String.Join("|", 0, 4)?

Working with Strings

  • Strings are immutable. Once they are created, if they are modified, the previous version is thrown away, and a new version is created.
  • To join strings, use +
  • String.Compare() is used to compare strings
  • .Insert and .Remove, .ToUpper and .ToLower, and .Split and .Join are just a few of the ways to deal with strings
  • A few more helpful, self-explanatory, functions:
    • .StartsWith and .EndsWith
    • .SubString
    • .PadLeft and .PadRight
    • .IndexOf and .IndexOfAny
    • .LastIndexOf and .LastIndexOfAny
  • Use the StringBuilder class if your strings will be modified multiple times
  • Using StringBuilder reduces memory usage
  • Some StringBuilder functions:
    • .Append
    • .Insert
    • .Remove
    • .Replace