0% found this document useful (0 votes)
107 views

String Functions Lesson Plan

This lesson introduces string functions and procedures in Delphi to work with string variables and their properties. String variables store text and are declared as type String. Functions like Length and Pos can retrieve properties of strings, such as the length of a string or the position of a substring within a string. Other topics covered are uppercase, lowercase, and using indexes to refer to individual characters in a string. Learning these string functions and procedures will enable input validation and string manipulation in the future.

Uploaded by

Nqobile Phokane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views

String Functions Lesson Plan

This lesson introduces string functions and procedures in Delphi to work with string variables and their properties. String variables store text and are declared as type String. Functions like Length and Pos can retrieve properties of strings, such as the length of a string or the position of a substring within a string. Other topics covered are uppercase, lowercase, and using indexes to refer to individual characters in a string. Learning these string functions and procedures will enable input validation and string manipulation in the future.

Uploaded by

Nqobile Phokane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

INFORMATION TECHNOLOGY: GRADE10

Date 31 August 2022


TOPIC String Functions and Procedures
AIMS OF LESSON This lesson introduces string functions and procedures with a view to their later use in data (input) validation.
RESOURCES Paper based resources Digital resources
DBE MTN Textbook; Chapter 6: Links on the WCED ePortal
(Use your school issued textbook for the same content) The e-resources below has the actual URL to the websites
INTRODUCTION Variables that hold text are declared as String types.
It is worth noting that a number of component properties use the String type (i.e. they store text values.) Examples include:
Button1.Caption; Edit1.Text; combobox.Items; memo.lines etc. We are often called to work with these properties.
In this lesson you will learn more about functions and procedures that manage the properties of strings. This knowledge will be needed in
the future, for doing such things as input validation and string manipulation.
In particular we will cover Length; Pos; index notation; uppercase and lowercase.
PRE-KNOWLEDGE Declaration and the use of variables
CONCEPTS AND SKILLS Predefined String functions and procedures that can be used in Delphi Imagine Each character in a String variable
we declare a variable someText as a String. can be referred to by using an
Imagine further that we assign the text value ‘The man jumps up’. index in the same way that we
Syntax examples:
refer to members of a list.
var someText: String;
... We can Illustrate the string and the position of it’s characters in this manner:
someText:=‘Hello World’; 1 2 3 4 5 6 7 8 9 10 11 Here are examples of the of
predefined functions and
H E L L 0 W 0 R L D procedures, that can be used in
Delphi to get the properties of
String variables or to manipulate
We understand a string to be list of characters. their contents.
Syntax examples: Length: To determine the length of a string we have the function Length.
iLength :=Length(someText); Syntax: SomeIntegerVariable := Length(SourceText);
Outcome: The variable iLength is assigned the value: 16.
var position: Integer; Pos: To determine the position of a substring within a given string we can use the Pos. CAN YOU?
... Syntax: someIntegerVariable := Pos(StrToBeFound, SourceText); Recall the syntax for:
position:= Pos(‘m’, someText); Outcome: The variable position is assigned the value: 5 (0 if not found).

You might also like