Presentation is loading. Please wait.

Presentation is loading. Please wait.

Manipulating Strings.

Similar presentations


Presentation on theme: "Manipulating Strings."— Presentation transcript:

1 Manipulating Strings

2 What is a string? Data composed of text characters.
The data is stored in consecutive bytes of memory. Each byte stores the ASCII code for a single character.

3 The 7-bit ASCII Character Set

4 Storing a String When a String type variable is declared, VB reserves 256 consecutive bytes of memory. The ASCII code for the fist character is stored in the first byte reserved. The code for the next character in the string is stored in the next byte.

5 Storing a String If the statement Dim name As String
reserves 256 bytes starting at 1000(Hex), then name = “Lew” places the ASCII code for ‘L’ in 1000, and the code for ‘e’ in 1001…

6 Storing a String The ASCII table provides the codes: L – 01001100
w –

7 Storing a String Memory location Content 00010000 00000000 01001100
Random junk

8 How are strings manipulated?
Program design requirements can pose a number of problems that can be solved by string manipulation. Chapter 5 of the “Programming for Literacy” illustrates several examples. Let’s look at Ex5-4.


Download ppt "Manipulating Strings."

Similar presentations


Ads by Google