Presentation is loading. Please wait.

Presentation is loading. Please wait.

String Manipulation By Felix Thompson, Jerzy Griffiths and Joel Sutcliffe.

Similar presentations


Presentation on theme: "String Manipulation By Felix Thompson, Jerzy Griffiths and Joel Sutcliffe."— Presentation transcript:

1 String Manipulation By Felix Thompson, Jerzy Griffiths and Joel Sutcliffe

2 What is string manipulation? String manipulation is interacting with strings to read information from them or limit what they can be. String manipulation is interacting with strings to read information from them or limit what they can be.

3 Reading data from a string Left – This reads a certain amount of characters in order going from left to right Left – This reads a certain amount of characters in order going from left to right Right– This reads a certain amount of characters in order going from right to left Right– This reads a certain amount of characters in order going from right to left Mid - This reads a certain length of the string going from a set point for a certain number of characters Mid - This reads a certain length of the string going from a set point for a certain number of characters

4 For example Text = Manipulation Text = Manipulation Left(Text, 5) would come as Manip Left(Text, 5) would come as Manip Right(Text, 6) would come as lation Right(Text, 6) would come as lation Mid(Text, 2,4) would come as nipu Mid(Text, 2,4) would come as nipu

5 Describing a string Locate – this tells you where in a string a certain character is. Locate – this tells you where in a string a certain character is. Length – this tells you the length of a string Length – this tells you the length of a string Locate(Text, “p”) would come out as 5 Locate(Text, “p”) would come out as 5 Len(Text) would come out as 12 Len(Text) would come out as 12

6 Character and ASCII values Asc - This returns the ASCII value of a single character. Asc - This returns the ASCII value of a single character. Chr – This returns the character of an ASCII value. Chr – This returns the character of an ASCII value. Asc(“B”) would come out as 66 Asc(“B”) would come out as 66 Chr(“66”) would come out as B Chr(“66”) would come out as B

7 Replace Use this to replace a set of characters to another set. Use this to replace a set of characters to another set. Text = hello world Text = hello world Replace(Text, “hello”, “goodbye”) Replace(Text, “hello”, “goodbye”) Text = goodbye world Text = goodbye world

8 Comparing strings When comparing strings it reads it as its ASCII value for example A < a because When comparing strings it reads it as its ASCII value for example A < a because A = 65 A = 65 a = 97 a = 97 a < ab because it adds the value together. a < ab because it adds the value together.


Download ppt "String Manipulation By Felix Thompson, Jerzy Griffiths and Joel Sutcliffe."

Similar presentations


Ads by Google