String Manipulation - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

String Manipulation

Description:

String Manipulation – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 6
Provided by: scie228
Category:

less

Transcript and Presenter's Notes

Title: String Manipulation


1
String Manipulation
STRING a collection of characters. STRING a
special type of array one row, multiple columns
The size of a string will differ with the
programming language. In BASIC, a string can
consist of 254 characters.
The position of each character in the string can
be mapped, and each character can be accessed
individually.
2
String Manipulation
There are three string manipulation commands. Two
are similar. The third is the most powerful.
Three commands LEFT MID RIGHT
LEFT - captures the characters, starting at the
first character on the left side of the string
RIGHT - captures the characters, starting at the
first character on the right side of the string
3
String Manipulation
LEFT RIGHT
SYNTAX LEFT(ltString namegt, Number of
characters) RIGHT(ltString namegt, Number of
characters) Must be stored in a string variable.
Example X My grade, in this class, is 92.3
A LEFT(X,5) B RIGHT(X, 3)
CAL(1) January CALS(1) LEFT(CAL(1), 3)
4
String Manipulation
MID - most flexible of string manipulation
commands
MID(ltstring variablegt, starting position, number
of characters) A MID(X,3,4)
Use MID to locate a specific character. Some
files use special characters to separate
data. Ex X My grade, in this class, is
92.3
5
String Manipulation
4000 capture percentage 4010 N 5
number of characters wanted 4020 L 0
letter counter 4030 FD N initialize
flag 4040 WHILE (FD N) 4050 L L 1
4060 Z MID(X,L,1) 4070 IF (Z
) THEN FD Y 4080 WEND 4090 LL L
N 4100 A MID(X,LL,N) 4110 PRINT
A 4120 AV VAL(A) 4130 PRINT AV 4190
RETURN
Write a Comment
User Comments (0)
About PowerShow.com