Created by Zaheer Abbas Aghani
Lecture 13 STRINGS PROCESSING
String (Definition) Computer terminology usually uses the term “string”  for the sequences of character. A Finite sequence of characters is called Strings. OR Anything that contains more than one character struck together.  For-example  “ This ” is a string.
Storing Strings Strings are stored in three types of structure: Fixed –length structures. Variable length structures with fixed maximums Linked structures.
Fixed –length structures 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. For example we will assume that our records have length 20 columns/characters then in memory strings will store as follows: 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
Variable Length storage with fixed maximum The storage of variable length in memory cells with fixed max can be done in two general ways: One can use a marker, such as two dollar sign ($$), to signal the end of the string. One can list the length of the string--- as an additional item in the pointer array $ $ End of String Fig: Records with sentinels s t r i g s 201 210 220
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
Linked Storage For  most extensive word processing applications, strings are stored by means of linked lists.  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. S t r i n g Fig: Linked List
String Constants Constant  is a value that store once in memory & it cannot be changed.  Many programming languages denotes string constant by placing the string in single or double quotation marks. For example:  ‘ The End’  or  “The End”  are string constants of length 7.

Lect 13 Zaheer Abbas

  • 1.
    Created by ZaheerAbbas Aghani
  • 2.
  • 3.
    String (Definition) Computerterminology usually uses the term “string” for the sequences of character. A Finite sequence of characters is called Strings. OR Anything that contains more than one character struck together. For-example “ This ” is a string.
  • 4.
    Storing Strings Stringsare stored in three types of structure: Fixed –length structures. Variable length structures with fixed maximums Linked structures.
  • 5.
    Fixed –length structuresIn 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. For example we will assume that our records have length 20 columns/characters then in memory strings will store as follows: 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.
    Variable Length storagewith fixed maximum The storage of variable length in memory cells with fixed max can be done in two general ways: One can use a marker, such as two dollar sign ($$), to signal the end of the string. One can list the length of the string--- as an additional item in the pointer array $ $ End of String Fig: Records with sentinels s t r i g s 201 210 220
  • 7.
    Variable length storagewith 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.
    Linked Storage For most extensive word processing applications, strings are stored by means of linked lists. 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. S t r i n g Fig: Linked List
  • 9.
    String Constants Constant is a value that store once in memory & it cannot be changed. Many programming languages denotes string constant by placing the string in single or double quotation marks. For example: ‘ The End’ or “The End” are string constants of length 7.