Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lect 13 Zaheer Abbas


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Lect 13 Zaheer Abbas

  1. 1. Created by Zaheer Abbas Aghani
  2. 2. Lecture 13 STRINGS PROCESSING
  3. 3. String (Definition) <ul><li>Computer terminology usually uses the term “string” for the sequences of character. </li></ul><ul><li>A Finite sequence of characters is called Strings. </li></ul><ul><li>OR </li></ul><ul><li>Anything that contains more than one character struck together. </li></ul><ul><li>For-example “ This ” is a string. </li></ul>
  4. 4. Storing Strings <ul><li>Strings are stored in three types of structure: </li></ul><ul><li>Fixed –length structures. </li></ul><ul><li>Variable length structures with fixed maximums </li></ul><ul><li>Linked structures. </li></ul>
  5. 5. Fixed –length structures <ul><li>In fixed length storage each line of strings is viewed as a records, where all records have the same length i.e. where each record accommodates the same number of characters. </li></ul><ul><li>For example we will assume that our records have length 20 columns/characters then in memory strings will store as follows: </li></ul>T O B E O R N O T T O B E 221 230 240 241 250 260 s t r i g s p r o c e s s i n g s t r i g s 201 210 220
  6. 6. Variable Length storage with fixed maximum <ul><li>The storage of variable length in memory cells with fixed max can be done in two general ways: </li></ul><ul><li>One can use a marker, such as two dollar sign ($$), to signal the end of the string. </li></ul><ul><li>One can list the length of the string--- as an additional item in the pointer array </li></ul>$ $ End of String Fig: Records with sentinels s t r i g s 201 210 220
  7. 7. Variable length storage with pointer 20 10 2 p r o c e s s i n g s Pointer Fig: Records whose lengths are listed s t r i n g
  8. 8. Linked Storage <ul><li>For most extensive word processing applications, strings are stored by means of linked lists. </li></ul><ul><li>Strings may be stored in linked list as follows. Each memory cell assigned one character , and a link contained in the cell gives the address of the cell containing the next character. For example following fig shows how “string” word would appear in memory with one character per node. </li></ul>S t r i n g Fig: Linked List
  9. 9. String Constants <ul><li>Constant is a value that store once in memory & it cannot be changed. </li></ul><ul><li>Many programming languages denotes string constant by placing the string in single or double quotation marks. </li></ul><ul><li>For example: ‘ The End’ or “The End” are string constants of length 7. </li></ul>