1 / 7

Thinking about Strings

Discover the basics of strings - sequences of characters - and learn how they can be manipulated and analyzed. Explore various operations on strings and understand their applications to other types of data sequences.

felixe
Download Presentation

Thinking about 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. Thinking about Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg

  2. What are strings? • Sequences of characters • We will often work with sequences of data • String is just a specific example • We will see many of the things we do with strings later on with other sequences of data

  3. Sequences of data • Can work with size of sequence • Can work with individual pieces of information in the sequence

  4. Thought Exercise • Suppose I give you a string >>> mesg = “Today is Friday” • What is the length of that string?

  5. Thought Exercise >>> mesg = “Today is Friday” • mesg[1] • mesg[11] • mesg[-1] • mesg[3:9] • mesg[10:] • mesg[10:37]

  6. Questions so far?

  7. Let’s talk about the lab • Sequences, indexes, and slicing. • Reversing the Str • Working backwards and appending • Working forwards and prepending • Counting the vowels • Handling both cases

More Related