NOTES: String Functions (module 12)

Size: px
Start display at page:

Download "NOTES: String Functions (module 12)"

Transcription

1 Computer Science 110 NAME: NOTES: String Functions (module 12) String Functions In the previous module, we had our first look at the String data type. We looked at declaring and initializing strings, how to concatenate, or join, strings and the null string. As you have learned, strings hold character data. There are times when the programmer does not care what is in a string the string is just data that is passed from one part of the program to another. Other times, it may be necessary to perform such tasks as verifying the contents of a string, modifying the string or retrieving specific information from a string. In this module, we will look at some of the Visual Basic built-in string functions that allow you to manipulate strings to obtain data from them. String Conversion Functions String conversion functions include functions for converting the case of letters in a string. These functions include: LCase: Converts letters to lower case UCase: Converts letters to upper case StrConv: Converts according to a Visual Basic predefined constant The LCase Function The LCase function uses the following syntax: LCase returns the string argument (in parentheses) as an all lower case string, as shown in the following example: strnurseryrhyme = "Three Blind Mice" lbldisplaynurseryrhyme.caption = LCase(strNurseryRhyme) The output that would be displayed in the label would be three blind mice. Notice the characters in the string are all converted to lower case. The UCase Function The UCase function uses the following syntax: UCase returns the string argument as an all upper case string, as demonstrated in the following example: strnurseryrhyme = "Three Blind Mice" lbldisplaynurseryrhyme.caption = UCase(strNurseryRhyme) The output that would be displayed in the label would be THREE BLIND MICE,with the characters all converted to upper case. The StrConv Function The syntax for the StrConv function is: The conversion argument can be: vbuppercase: Converts the string to upper case, similar to UCase vblowercase: Converts the string to lower case, similar to LCase vbpropercase: Converts the first letter in each word of the string to upper case and converts all other letters to lower case The string will be returned according to which of these conversion constants is used. The following example shows the StrConv function: strnurseryrhyme = "ThrEE blind mice" lbldisplaynurseryrhyme.caption = StrConv(strNurseryRhyme, vbpropercase) The output that would be displayed in the label is Three Blind Mice, with the first letter of each word changed to upper case.

2 Manipulating Strings Visual Basic has several built-in functions for manipulating strings. Many of these functions are useful for parsing, or analyzing, a string. These functions can be used for extracting smaller sections, called substrings, from a string. For example, there are functions that allow you to locate and extract one character, one word or a phrase from a string. The Left Function The syntax for the Left function is: Left returns the length, or number of characters, starting from the left of the string. Let's look at an example: strname = "Janice" lbldisplayname.caption = Left(strName, 3) The label would display the characters Jan, the three characters from the left in the Janice string. The Right Function The syntax for the Right function is: Right returns a length of characters starting from the right side of the string, as in the next example: strname = "Janice" lbldisplayname.caption = Right(strName, 4) In this example, the label would display the characters nice, the four characters from the right side of the Janice string. The Mid Function The Mid function returns characters from any part of the string. The syntax for the Mid function is: Length is the number of characters to return, as in the example: strname = "Janice" lbldisplayname.caption = Mid(strName,2,4) In this example, the code would return the characters anic, beginning with the second character and returning four characters from the Janice string.

3 The Mid Statement The Mid statement is similar to the Mid function. The Mid statement is used to replace a specified number of characters in a string. The syntax for the Mid statement is shown in the graphic on the right: The following code demonstrates how the Mid statement is used: strname = "April" Mid(strName,2,3) = "Janice" lbldisplayname.caption = strname The strname variable is assigned the value April as it first appears in the code. Starting with the second letter, p, in April, the three characters pri in April are replaced with Jan in Janice. The label will show AJanl. Note that when the Mid statement is used, it appears on the left side of the assignment statement. The Mid function appears on the right side of the assignment statement. For example: Mid statement: Mid(strName,2,3) = "Janice" Mid function: lbldisplayname.caption = Mid(strName,2,4) The Len Function The Len function returns a count of the number of characters in a string. It, too, is a Visual Basic built-in function. The syntax for the Len function is: Len returns the number of characters in the string, as shown in this example: strnurseryrhyme = "Three Blind Mice" lbldisplaynurseryrhyme.caption = Len(strNurseryRhyme) The label will display the return value of 16. Why 16 and not 14? Remember, a space is a character, so there are 16 characters in Three Blind Mice. The InStr Function The InStr function is a built-in Visual Basic function that returns the starting position of a substring (a portion of a string). The syntax for the InStr function is: The following code demonstrates InStr: Dim strmonth As String, strsubstring As String Dim intstart As Integer strmonth = "January" strsubstring = "ar" intstart = 3 lbldisplayposition.caption = InStr(intStart, strmonth, strsubstring) The label will display the return value 5, as the substring begins at position 5. The search began at position 3. In this example: Dim strmonth As String, strsubstring As String strmonth = "January" strsubstring = "ar" lbldisplayposition.caption = InStr(intStart, strmonth, strsubstring) The label will display the value 5. A start position was not indicated, so searching began at position one, by default.

4 In this final example: Dim strmonth As String, strsubstring As String Dim intstart As Integer strmonth = "January" strsubstring = "an" intstart = 4 lbldisplayposition.caption = InStr(intStart, strmonth, strsubstring) The label will display 0 because the substring is never found. The start position was position 4 and the substring appears before position 4. If a substring is not found, Visual Basic returns zero (0), by default. Generating Strings In this lesson, we will look at Visual Basic built-in string functions that allow us to generate strings. These functions include: String Space & operator vbtab vbcrlf The String Function The String function is a Visual Basic built-in function that returns a string of repeating characters. The syntax for the String function is: The following code example demonstrates the use of the String function: Dim strhorizontalrule As String strhorizontalrule = String(20, "*") lbldisplaystring.caption = strhorizontalrule This code will display the following in the label: ******************** The Space Function The Space function is the Visual Basic built-in function that returns a string of spaces. The syntax for the Space function is: The following code demonstrates the Space function: Dim strblanks As String strblanks = Space(20) lbldisplaystring.caption = strblanks The label, according to the above code, would display (20 spaces).

5 String Concatenation The & operator is used to concatenate or join two or more strings into one string. The syntax for use of the & operator to concatenate strings is: The following is an example of string concatenation and the use of the & operator: Dim strfirstword As String, strsecondword As String Dim strthirdword As String Dim strphrase As String strfirstword = "tic" strsecondword = "tac" strthirdword = "toe" strphrase = strfirstword & strsecondword & strthirdword lblshowphrase.caption = strphrase 'Adds one space between words strphrase = strfirstword & Space(1) & strsecondword & Space(1) & strthirdword lblshowphrase.caption = strphrase The statement: strphrase = strfirstword & strsecondword & strthirdword will output tictactoe in the label. A space is then inserted between tic and tac and between tac and toe with the statement: strphrase = strfirstword & Space(1) & strsecondword & Space(1) & strthirdword to change the output to tic tac toe. The vbtab and vbcrlf Functions Two constants that are useful with strings are vbtab and vbcrlf. vbtab: Represents the Tab character Can be used to place eight spaces in a string vbcrlf: Represents a carriage return/linefeed combination Used to move text to the next line The following example: MsgBox "One step" & vbtab & "forward," & vbcrlf & "two steps back." will show the following string in a message box: One step forward, two steps back. Comparing Strings Recall from earlier units that computers can only store numerical data stored in memory as bytes. Each byte is made up of eight bits. Each bit is either on or off. When a bit is on, it is said to store a one (1), and when it is off, it stores a zero (0). The 1s and 0s stored by a computer represent the binary number system. Also recall that when a character, such as a letter of the alphabet, needs to be stored in memory, it is stored as a number. The ASCII code represents characters as numbers. Strings (which are strings of characters) can be compared, for example, to determine if one string is the same as another string or to see if one string comes alphabetically before or after another. If we use relational operators (=, >, <, <=, >=, <>) for making these comparisons, we would use the internal binary representation of the characters to determine the relationships. For example, the comparison "B" < "a" would be True because an uppercase B is represented in ASCII by the number 66 and the lowercase representation for a is 97. Visual Basic has built-in functions that allow us to perform textual comparisons on strings. A textual comparison is a comparison that does not distinguish between uppercase and lowercase letters. Two ways to perform textual comparisons are to use the: 1. StrComp function with the vbtextcompare constant 2. Like operator

6 The StrComp Function The syntax for the StrComp function is: Example #1 Dim strfirstword As String, strsecondword As String strfirstword = "olives" strsecondword = "artichokes" 'The following will display: First word comes after second word If StrComp(strFirstWord, strsecondword, vbtextcompare) = 0 Then lblmessage.caption = "Both words are the same" ElseIf StrComp(strFirstWord, strsecondword, vbtextcompare) = -1 Then lblmessage.caption = "First word comes before second word" Else lblmessage.caption = "First word comes after second word" End If Example #2 Dim strfirstword As String, strsecondword As String strfirstword = "artichokes" strsecondword = "artichokes" 'The following will display: Both words are the same If StrComp(strFirstWord, strsecondword, vbtextcompare) = 0 Then lblmessage.caption = "Both words are the same" ElseIf StrComp(strFirstWord, strsecondword, vbtextcompare) = -1 Then lblmessage.caption = "First word comes before second word" Else lblmessage.caption = "First word comes after second word" End If The Like Operator The Like operator can also be used to perform textual comparisons on strings. Like is usually used to perform pattern matching. For example, you may wish to look for strings that end with the pattern "*ion." In this example, the * is a wildcard that replaces characters and ion is the pattern you are looking for. The syntax for comparisons using the Like operator is shown.

7 Pattern matching allows for the use of wildcard characters, character lists and character ranges to compare strings (as shown in the table below). Wildcard How to use Example pattern? Used in place of any single character * Used in place of many characters # Used in place of any single number [ ] Used to enclose a list of characters - Used to indicate a range of characters in a character list, Used to separate characters in a character list strpattern = "?un" strpattern = "Letter to *" strpattern = "Case ##8#" strpattern = "[a,b,c,d,e]" strpattern = "[a - e]" strpattern = "[a,b,c]" Code Examples Dim strword As String, strpattern As String strword = "Run" strpattern = "?un" strword = "Run" strpattern = "?um" lblmessage.caption = strword Like strpattern 'Displays False strword = "Letter to Jordan" strpattern = "Letter to *" strword = "Case 9876" strpattern = "Case 987#" strword = "Case 9876" strpattern = "Case ##6#" lblmessage.caption = strword Like strpattern 'Displays False strword = "c" strpattern = "[a,b,c,d,e]" strword = "b" strpattern = "[a-f]"

String Functions on Excel Macros

String Functions on Excel Macros String Functions on Excel Macros The word "string" is used to described the combination of one or more characters in an orderly manner. In excel vba, variables can be declared as String or the Variant

More information

Chapter 2.4: Common facilities of procedural languages

Chapter 2.4: Common facilities of procedural languages Chapter 2.4: Common facilities of procedural languages 2.4 (a) Understand and use assignment statements. Assignment An assignment is an instruction in a program that places a value into a specified variable.

More information

NOTES: Procedures (module 15)

NOTES: Procedures (module 15) Computer Science 110 NAME: NOTES: Procedures (module 15) Introduction to Procedures When you use a top-down, structured program design, you take a problem, analyze it to determine what the outcome should

More information

Changing Case using Worksheet Functions and Excel VBA

Changing Case using Worksheet Functions and Excel VBA Excel provides the text worksheet functions, namely the Upper Function, the Lower Function and the Proper Function, which can change the case of a specified input text string. This text string could be

More information

Understanding Regular Expressions, Special Characters, and Patterns

Understanding Regular Expressions, Special Characters, and Patterns APPENDIXA Understanding Regular Expressions, Special Characters, and Patterns This appendix describes the regular expressions, special or wildcard characters, and patterns that can be used with filters

More information

Complete program to solve a 2 nd degree equation

Complete program to solve a 2 nd degree equation Fundamentals of Computer Science 2010-2011 Laboratory 10 Functions and procedures (3) Objectives: To go deeply into the use of subprograms and passing parameters by reference To go deeply into the manipulation

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Strings and Escape Characters Primitive Data Types Variables, Initialization, and Assignment Constants Reading for this lecture: Dawson, Chapter 2 http://introcs.cs.princeton.edu/python/12types

More information

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid: 1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,

More information

Strings in Visual Basic. Words, Phrases, and Spaces

Strings in Visual Basic. Words, Phrases, and Spaces Strings in Visual Basic Words, Phrases, and Spaces Strings are a series of characters. Constant strings never change and are indicated by double quotes. Examples: Fleeb Here is a string. Strings are a

More information

CMPT 125: Lecture 3 Data and Expressions

CMPT 125: Lecture 3 Data and Expressions CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,

More information

The Warhol Language Reference Manual

The Warhol Language Reference Manual The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

More information

Separate, Split & Remove Substring & Number from Text with Excel Functions & VBA

Separate, Split & Remove Substring & Number from Text with Excel Functions & VBA [Editor s Note: This is a guide on how to separate, split & remove substring & numbers from text using Excel Functions and VBA. Examples of substring functions are CHAR, FIND, LEFT, LOWER, MID, PROPER,

More information

Basic data types. Building blocks of computation

Basic data types. Building blocks of computation Basic data types Building blocks of computation Goals By the end of this lesson you will be able to: Understand the commonly used basic data types of C++ including Characters Integers Floating-point values

More information

VISUAL BASIC 6.0 OVERVIEW

VISUAL BASIC 6.0 OVERVIEW VISUAL BASIC 6.0 OVERVIEW GENERAL CONCEPTS Visual Basic is a visual programming language. You create forms and controls by drawing on the screen rather than by coding as in traditional languages. Visual

More information

REVIEW. The C++ Programming Language. CS 151 Review #2

REVIEW. The C++ Programming Language. CS 151 Review #2 REVIEW The C++ Programming Language Computer programming courses generally concentrate on program design that can be applied to any number of programming languages on the market. It is imperative, however,

More information

Please answer questions in the space provided. Question point values are shown in parentheses.

Please answer questions in the space provided. Question point values are shown in parentheses. IS 320 Spring 99 Page 1 Please answer questions in the space provided. Question point values are shown in parentheses. 1. (15) Assume you have the following variable declarations and assignments: Dim A

More information

Petros: A Multi-purpose Text File Manipulation Language

Petros: A Multi-purpose Text File Manipulation Language Petros: A Multi-purpose Text File Manipulation Language Language Reference Manual Joseph Sherrick js2778@columbia.edu June 20, 2008 Table of Contents 1 Introduction...................................................

More information

BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132) BoredGames Language Reference Manual A Language for Board Games Brandon Kessler (bpk2107) and Kristen Wise (kew2132) 1 Table of Contents 1. Introduction... 4 2. Lexical Conventions... 4 2.A Comments...

More information

Phụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number.

Phụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number. Phụ lục 2 Bởi: Khoa CNTT ĐHSP KT Hưng Yên Language Element Abs Function Array Function Asc Function Atn Function CBool Function CByte Function CCur Function CDate Function CDbl Function Chr Function CInt

More information

Access VBA programming

Access VBA programming Access VBA programming TUTOR: Andy Sekiewicz MOODLE: http://moodle.city.ac.uk/ WEB: www.staff.city.ac.uk/~csathfc/acvba The DoCmd object The DoCmd object is used to code a lot of the bread and butter operations

More information

COMPUTER SCIENCE SECTION A

COMPUTER SCIENCE SECTION A Total No. of Printed Pages 16 X/14/CSc 2 0 1 4 COMPUTER SCIENCE ( CANDIDATES WITH PRACTICAL/INTERNAL ASSESSMENT ) Full Marks : 80 Pass Marks : 24 ( CANDIDATES WITHOUT PRACTICAL/INTERNAL ASSESSMENT ) Full

More information

I101/B100 Problem Solving with Computers

I101/B100 Problem Solving with Computers I101/B100 Problem Solving with Computers By: Dr. Hossein Computer Science and Informatics IU South Bend 1 What do we need to learn in order to write computer programs? Fundamental programming constructs:

More information

In-Built Functions. String Handling Functions:-

In-Built Functions. String Handling Functions:- L i b r a r y F u n c t i o n s : String Handling Functions:- In-Built Functions 1) LTrim() :- Usage: The LTrim() function returns a string containing a copy of specified string without leading spaces.

More information

LESSON 4. The DATA TYPE char

LESSON 4. The DATA TYPE char LESSON 4 This lesson introduces some of the basic ideas involved in character processing. The lesson discusses how characters are stored and manipulated by the C language, how characters can be treated

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Data Types Literals, Variables & Constants

Data Types Literals, Variables & Constants VISUAL BASIC Data Types Literals, Variables & Constants Copyright 2013 Dan McElroy Under the Hood As a DRIVER of an automobile, you may not need to know everything that happens under the hood, although

More information

Advanced Handle Definition

Advanced Handle Definition Tutorial for Windows and Macintosh Advanced Handle Definition 2017 Gene Codes Corporation Gene Codes Corporation 525 Avis Drive, Ann Arbor, MI 48108 USA 1.800.497.4939 (USA) +1.734.769.7249 (elsewhere)

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Introduction to String Manipulation

Introduction to String Manipulation Introduction to Computer Programming Introduction to String Manipulation CSCI-UA.0002 What is a String? A String is a data type in the Python programming language A String can be described as a "sequence

More information

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */ Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,

More information

Discussion 1H Notes (Week 4, April 22) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 4, April 22) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 4, April 22) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 Passing Arguments By Value and By Reference So far, we have been passing in

More information

X Language Definition

X Language Definition X Language Definition David May: November 1, 2016 The X Language X is a simple sequential programming language. It is easy to compile and an X compiler written in X is available to simplify porting between

More information

Essentials for Scientific Computing: Stream editing with sed and awk

Essentials for Scientific Computing: Stream editing with sed and awk Essentials for Scientific Computing: Stream editing with sed and awk Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Stream Editing sed and awk are stream processing commands. What this means is that they are

More information

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl)

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) Regular Expressions Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) JavaScript started supporting regular expressions in

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

Chapter 3: Programming with MATLAB

Chapter 3: Programming with MATLAB Chapter 3: Programming with MATLAB Choi Hae Jin Chapter Objectives q Learning how to create well-documented M-files in the edit window and invoke them from the command window. q Understanding how script

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

Text. Text Actions. String Contains

Text. Text Actions. String Contains Text The Text Actions are intended to refine the texts acquired during other actions, for example, from web-elements, remove unnecessary blank spaces, check, if the text matches the defined content; and

More information

Ellucian Banner 9 and Colleague UI 5 LearnMode Integration

Ellucian Banner 9 and Colleague UI 5 LearnMode Integration Ellucian Banner 9 and Colleague UI 5 LearnMode Integration Administrator s Getting Started Guide Versions: 7.1.5.1899 and higher and 7.2.2.443 and higher Written by: Product Knowledge, R&D Date: May 2018

More information

Digital Representation

Digital Representation Digital Representation INFO/CSE 100, Spring 2006 Fluency in Information Technology http://www.cs.washington.edu/100 4/14/06 fit100-08-digital 1 Reading Readings and References» Fluency with Information

More information

Section 2.2 Your First Program in Java: Printing a Line of Text

Section 2.2 Your First Program in Java: Printing a Line of Text Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two

More information

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition

More information

UNIT 5. String Functions and Random Numbers

UNIT 5. String Functions and Random Numbers UNIT 5 String Functions and Random Numbers DAY 1 String data type String storage in data String indexing I can.. Explain the purpose of the string variable type and how it is stored in memory. Explain

More information

variables programming statements

variables programming statements 1 VB PROGRAMMERS GUIDE LESSON 1 File: VbGuideL1.doc Date Started: May 24, 2002 Last Update: Dec 27, 2002 ISBN: 0-9730824-9-6 Version: 0.0 INTRODUCTION TO VB PROGRAMMING VB stands for Visual Basic. Visual

More information

Language Reference Manual

Language Reference Manual ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents

More information

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points) Standard 11 Lesson 9 Introduction to C++( Up to Operators) 2MARKS 1. Why C++ is called hybrid language? C++ supports both procedural and Object Oriented Programming paradigms. Thus, C++ is called as a

More information

Review of Important Topics in CS1600. Functions Arrays C-strings

Review of Important Topics in CS1600. Functions Arrays C-strings Review of Important Topics in CS1600 Functions Arrays C-strings Array Basics Arrays An array is used to process a collection of data of the same type Examples: A list of names A list of temperatures Why

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Introduction to string

Introduction to string 1 Introduction to string String is a sequence of characters enclosed in double quotes. Normally, it is used for storing data like name, address, city etc. ASCII code is internally used to represent string

More information

Chapter 9 Strings. With this array declaration: char s[10];

Chapter 9 Strings. With this array declaration: char s[10]; Chapter 9 Strings 9.1 Chapter Overview There is no data type in C called ʻstringʼ; instead, strings are represented by an array of characters. There is an assortment of useful functions for strings that

More information

Sprite an animation manipulation language Language Reference Manual

Sprite an animation manipulation language Language Reference Manual Sprite an animation manipulation language Language Reference Manual Team Leader Dave Smith Team Members Dan Benamy John Morales Monica Ranadive Table of Contents A. Introduction...3 B. Lexical Conventions...3

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

StudyHub+ 1. StudyHub: AP Java. Semester One Final Review

StudyHub+ 1. StudyHub: AP Java. Semester One Final Review StudyHub+ 1 StudyHub: AP Java Semester One Final Review StudyHub+ 2 Terminology: Primitive Data Type: Most basic data types in the Java language. The eight primitive data types are: Char: A single character

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

String Class in C++ When the above code is compiled and executed, it produces result something as follows: cin and strings

String Class in C++ When the above code is compiled and executed, it produces result something as follows: cin and strings String Class in C++ The standard C++ library provides a string class type that supports all the operations mentioned above, additionally much more functionality. We will study this class in C++ Standard

More information

Full file at

Full file at Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional

More information

The Java Language Rules And Tools 3

The Java Language Rules And Tools 3 The Java Language Rules And Tools 3 Course Map This module presents the language and syntax rules of the Java programming language. You will learn more about the structure of the Java program, how to insert

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

More information

Introduction to Programming, Aug-Dec 2006

Introduction to Programming, Aug-Dec 2006 Introduction to Programming, Aug-Dec 2006 Lecture 3, Friday 11 Aug 2006 Lists... We can implicitly decompose a list into its head and tail by providing a pattern with two variables to denote the two components

More information

Computers Programming Course 11. Iulian Năstac

Computers Programming Course 11. Iulian Năstac Computers Programming Course 11 Iulian Năstac Recap from previous course Cap. Matrices (Arrays) Matrix representation is a method used by a computer language to store matrices of different dimension in

More information

Learning Excel VBA. Using Loops in Your Code. ComboProjects. Prepared By Daniel Lamarche

Learning Excel VBA. Using Loops in Your Code. ComboProjects. Prepared By Daniel Lamarche Learning Excel VBA Using s in Your Code Prepared By Daniel Lamarche ComboProjects Using s in Your Code By Daniel Lamarche (Last update June 2016). s are pretty simple in concept however many new programmers

More information

VARIABLES AND CONSTANTS

VARIABLES AND CONSTANTS UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data

More information

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are

More information

Chapter 5 BET TER ARRAYS AND STRINGS HANDLING

Chapter 5 BET TER ARRAYS AND STRINGS HANDLING Chapter 5 BET TER ARRAYS AND STRINGS HANDLING Chapter Objective Manage arrays with the foreach loop Create and use associative arrays Extract useful information from some of PHP s built-in arrays Build

More information

Language Reference Manual simplicity

Language Reference Manual simplicity Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

More information

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards Language Reference Manual Introduction The purpose of

More information

INTRODUCTION TO MYSQL MySQL : It is an Open Source RDBMS Software that uses Structured Query Language. It is available free of cost. Key Features of MySQL : MySQL Data Types: 1. High Speed. 2. Ease of

More information

Sébastien Mathier www.excel-pratique.com/en Conditions : Conditions are very useful in programming because they allow us to execute actions based on specific criteria (it's the same principle as the IF

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

More information

JAVA Programming Fundamentals

JAVA Programming Fundamentals Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

More information

Chapter 2: Introduction to C++

Chapter 2: Introduction to C++ Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++

More information

Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Lesson 02 Data Types and Statements MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Topics Covered Statements Variables Data Types Arithmetic

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine

More information

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and

More information

NOTES: Variables & Constants (module 10)

NOTES: Variables & Constants (module 10) Computer Science 110 NAME: NOTES: Variables & Constants (module 10) Introduction to Variables A variable is like a container. Like any other container, its purpose is to temporarily hold or store something.

More information

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley

More information

Number Systems, Scalar Types, and Input and Output

Number Systems, Scalar Types, and Input and Output Number Systems, Scalar Types, and Input and Output Outline: Binary, Octal, Hexadecimal, and Decimal Numbers Character Set Comments Declaration Data Types and Constants Integral Data Types Floating-Point

More information

Higher Computing Science Software Design and Development - Programming Summary Notes

Higher Computing Science Software Design and Development - Programming Summary Notes Higher Computing Science Software Design and Development - Programming Summary Notes Design notations A design notation is the method we use to write down our program design. Pseudocode is written using

More information

Programming and Data Structures

Programming and Data Structures Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()

More information

used for US Census; Holes were made to represent information to be tabulated were punched in cards; Successful

used for US Census; Holes were made to represent information to be tabulated were punched in cards; Successful Essential Standard: 1.00 Understand ethics, security and the history of computer programming Indicator 1.01 Understand the evolution of computers and computer programming languages Indicator 1.02 Understand

More information

Java Programming Fundamentals. Visit for more.

Java Programming Fundamentals. Visit  for more. Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

Java Programming. String Processing. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Java Programming. String Processing. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved. Java Programming String Processing 1 Copyright 2013, Oracle and/or its affiliates. All rights Overview This lesson covers the following topics: Read, search, and parse Strings Use StringBuilder to create

More information

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5

St. Benedict s High School. Computing Science. Software Design & Development. (Part 1 Computer Programming) National 5 Computing Science Software Design & Development (Part 1 Computer Programming) National 5 VARIABLES & DATA TYPES Variables provide temporary storage for information that will be needed while a program is

More information

Installing and Using the Cisco Unity Express Script Editor

Installing and Using the Cisco Unity Express Script Editor Installing and Using the Cisco Unity Express Script Editor The Cisco Unity Express Script Editor allows you to create and validate scripts for handling calls that reach the auto attendant application.

More information

ITP 342 Mobile App Dev. Strings

ITP 342 Mobile App Dev. Strings ITP 342 Mobile App Dev Strings Strings You can include predefined String values within your code as string literals. A string literal is a sequence of characters surrounded by double quotation marks (").

More information

Programming Language 2 (PL2)

Programming Language 2 (PL2) Programming Language 2 (PL2) 337.1.1 - Explain rules for constructing various variable types of language 337.1.2 Identify the use of arithmetical and logical operators 337.1.3 Explain the rules of language

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information