CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.

Slides:



Advertisements
Similar presentations
CSI 1306 PROGRAMMING IN VISUAL BASIC PART 2. Part 2  1. Strings  2. Translating Conditional Branch Instructions  3. Translation Set 2  4. Debugging.
Advertisements

Manipulating Strings String Functions. VB provides a large number of functions that facilitate working with strings. These are found in Microsoft.VisualBasic.Strings.
Visual Basic Statements Chapter 5. Relational Operators  OperationSymbol  Equal  =  Less than  <  Greater than  >  Not equal   Less than.
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Proyek Queri-queri Lanjut dan Sub-subqueri. Variables dan Data.
Slide 1 VB Programming Fundamentals. Slide 2 Visual Basic Language v VB language is powerful and easy to use v Descendent of BASIC (Beginner's All-Purpose.
String Variables Visual Basic for Applications 4.
1 Pertemuan 04 Expression Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Strings in Visual Basic Words, Phrases, and Spaces.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
Comparing Numeric Values If Val(Text1.Text) = MaxPrice Then (Is the current numeric value stored in the Text property of Text1 equal to the value stored.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
On to… string operations & functions. Concatenation (&) §When we want to combine two character strings into one new (longer) string, we can concatenate.
Processing Decisions Chapter 3. If…Then…Else… Statements If decSalesAmount > 1000 Then sngTaxRate =.05 Else sngTaxRate =.07 End If.
Chapter Three Using Variables and Constants Programming with Microsoft Visual Basic th Edition.
Chapter 5 new The Do…Loop Statement
BACS 287 Visual Basic String Manipulation. BACS 287 Visual Basic Strings In Visual Basic, a “string” is a series of text, numbers, and special characters.
Chapter 31 Fundamentals of Programming in Visual Basic (Continue VI) String Properties and Methods: "Visual".Length is 6. "Visual".ToUpper is VISUAL. "123.
1.
Strings PART II STRING$ AND SPACE$. Create strings of specified number String$ creates string of specified character Space$ creates string of spaces Example:
Dani Vainstein1 VBScript Session 9. Dani Vainstein2 What we learn last session? VBScript coding conventions. Code convention usage for constants, variables,
Programming with Microsoft Visual Basic th Edition CHAPTER THREE USING VARIABLES AND CONSTANTS.
Tutorial 14 Working with Forms and Regular Expressions.
CIS162AD - C# Decision Statements 04_decisions.ppt.
Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.
Manipulation Masterclass By the VB Gods. In this masterclass, we will learn how to use some of the string manipulation function such as Len, Right, Left,
Chapter 3 Processing and Interactive Input. 2 Assignment  The general syntax for an assignment statement is variable = operand; The operand to the right.
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
Definition Various stream manipulators can be used to specify the kinds of formatting to be performed during stream-I/O operations. Stream manipulators.
Making Decisions. 4.1 Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
Manipulating Strings. What is a string? Data composed of text characters. The data is stored in consecutive bytes of memory. Each byte stores the ASCII.
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 4: Making Decisions.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Chapter Making Decisions 4. Relational Operators 4.1.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Three Using Variables and Constants.
H2K Infosys is business based in Atlanta, Georgia – United States Providing Online IT training services world wide. USA - +1-(770) ,
Validation final steps Stopping gaps being entered in an input.
Tutorial 3: Using Variables and Constants1 Tutorial 3 Using Variables and Constants.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
© 2006 Lawrenceville Press Slide 1 Chapter 6 The Post-Test Do…Loop Statement  Loop structure that executes a set of statements as long as a condition.
Controlling Program Flow with Looping Structures
Visual Basic.net Functions. Function (Defined) A procedure that returns a value when called.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 4: Making Decisions 1.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 11 So Many Paths … So Little Time.
1 Inside Module 8 Extracting Data Page n Using the Extract command2 n Coercion3 n $-functions4 n Extract from a table7.
[ ] Square brackets enclose syntax options { } Braces enclose items of which only one is required | A vertical bar denotes options … Three dots indicate.
Strings PART I STRINGS, DATES, AND TIMES. FUNDAMENTALS OF CHARATERS AND STRINGS VB represents characters using American National Standards Institute(ANSI)
Lecture 6 – Selection FTMK, UTeM – Sem /2014.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
Programming with Microsoft Visual Basic 2012 Chapter 3: Using Variables and Constants.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
Chapter 6 Controlling Program Flow with Looping Structures.
13/06/ Strings Left, Right and Trim. 213/06/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
© 2010 Lawrenceville Press Slide 1 Chapter 5 The Do…Loop Statement  Loop structure that executes a set of statements as long as a condition is true. 
Lesson 4 String Manipulation. Lesson 4 In many applications you will need to do some kind of manipulation or parsing of strings, whether you are Attempting.
Chapter 4: Making Decisions.
4. Functions and Control Statements
Chapter 4: Making Decisions.
Chapter 4: Making Decisions.
Chapter 4 – Decisions 4.1 Relational and Logical Operators
Chapter 5 The Do…Loop Statement
VBScript Session 10.
MapInfo SQL String Functions
Presentation transcript:

CSC 162 Visual Basic I Programming

String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing spaces from the right side of string Trim( string ) –Removes leading spaces from the left side and trailing spaces from the right side of string

String Functions StrReverse( string ) –Reverses all the characters in string UCase( string ) –Converts all the characters in string to uppercase LCase( string ) –Converts all the characters in string to lowercase Replace( string, replacee, replacor, position ) –Replaces all occurrences of substring replacee with replacor beginning at position in string –position is optional (default value = 1).

String Functions String( quantity, character ) –Creates a string of quantity number of characters –character can either be a literal or a numeric code (65 = "A", 97 = "a", 42 = "*", etc.) Space( quantity ) –Creates a string of quantity number of spaces ( " " )

String Functions Asc( character ) –Returns the ASCII numeric code of character Chr( code ) –Returns the ASCII character whose number is code Val( string ) –Returns the numeric value of string –Caution: Val will convert expressions that begin with a number (Examples: 30something, 4ever, etc.) Str( number ) –Returns the string equivalent of number

String Functions IsNumeric( string ) –Returns whether string can represent a number (True / False) Hex( number ) or Hex( string ) –Formats number or string in hexadecimal notation Oct( number ) or Oct( string ) –Formats number or string in octal notation

Lab Assignment Create a data validation loop in which the user is continuously prompted ( InputBox ) for numeric input. 1.If the user enters a non-numeric value, the program should display an error message ( MsgBox ) and re-prompt for input. 2.If the user enters a numeric value, the program should display a congratulatory message ( MsgBox ). 3.If the user presses the Cancel button, the program should do nothing.