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.

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.
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.
Chapter 9 Characters and Strings. Topics Character primitives Character Wrapper class More String Methods String Comparison String Buffer String Tokenizer.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 9 Structures and Sequential Access Files.
1 Pertemuan 04 Expression Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Strings in Visual Basic Words, Phrases, and Spaces.
Introduction to Oracle9i: SQL1 Selected Single-Row Functions.
Introduction to Computing Dr. Nadeem A Khan. Lecture 6.
Chapter 7. 2 Objectives You should be able to describe: The string Class Character Manipulation Methods Exception Handling Input Data Validation Namespaces.
On to… string operations & functions. Concatenation (&) §When we want to combine two character strings into one new (longer) string, we can concatenate.
Manipulating Strings.
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.
1.
Strings PART II STRING$ AND SPACE$. Create strings of specified number String$ creates string of specified character Space$ creates string of spaces Example:
07/10/ Strings ASCII& Processing Strings with the Functions - Locate (Instr), Mid, Length (Len), Char (ChrW) & ASCII (Asc)
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,
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Chapter Six: Working With Arrays in Visual Basic.
C++ PROGRAMMING: PROGRAM DESIGN INCLUDING DATA STRUCTURES, FIFTH EDITION Chapter 10: Strings and string type.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
String Manipulation. Strings have their own properties and methods, just like a textbox or label or form does.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
Lecture 8 – SQL Joins – assemble new views from existing tables INNER JOIN’s The Cartesian Product Theta Joins and Equi-joins Self Joins Natural Join.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
© Oxford University Press All rights reserved. CHAPTER 6 STRINGS.
C++ String Class nalhareqi©2012. string u The string is any sequence of characters u To use strings, you need to include the header u The string is one.
H2K Infosys is business based in Atlanta, Georgia – United States Providing Online IT training services world wide. USA - +1-(770) ,
Working with Strings. String Structure A string in VBA can be variable length and has an internal structure Each character in the string has a position.
String Manipulation 10/21/2015 Lect#6 GC Strings have their own properties and methods, just like a textbox or label or form does. 10/21/2015 Lect#6.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
Copyright © Don Kussee 1410-Ch4 #521 CNS 1120 Chapter 4 Performing Calculations & Manipulating Data 1120-Ch4.PPT.
Characters and Strings
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
A FIRST BOOK OF C++ CHAPTER 14 THE STRING CLASS AND EXCEPTION HANDLING.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 9 Structures and Sequential Access Files.
Strings PART I STRINGS, DATES, AND TIMES. FUNDAMENTALS OF CHARATERS AND STRINGS VB represents characters using American National Standards Institute(ANSI)
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
CHAPTER FOUR Performing Calculations and Manipulating Data: Expressions.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
13/06/ Strings Left, Right and Trim. 213/06/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Microsoft Visual Basic 2005: Reloaded Second Edition
Lec 3: Data Representation
Data Representation.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Strings, StringBuilder, and Character
SAS in Data Cleaning.
Winter 2018 CISC101 11/16/2018 CISC101 Reminders
SQL Text Manipulation Farrokh Alemi, Ph.D.
Decision Structures, String Comparison, Nested Structures
CIS16 Application Development and Programming using Visual Basic.net
CS 106 Computing Fundamentals II Chapter 66 “Working With Strings”
4.1 Strings ASCII & Processing Strings with the Functions
Sub Procedures and Functions
VBScript Session 10.
The Data Element.
Introduction to Computer Science
MapInfo SQL String Functions
The Data Element.
Trainer: Bach Ngoc Toan– TEDU Website:
Presentation transcript:

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 code for a single character.

The ASCII Character Set Hex ABCDEF Binary BSHTLF CR ESC !"#$%&'()*+,-./ :;<=>? PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~DEL

Storing a String When a String type variable is declared in VB6, 256 consecutive bytes of memory are reserved. The ASCII code for the fist character is stored in the first byte reserved. The code for the next character in the string is stored in the next byte.

Storing a String If the statement Dim name As String reserves 256 bytes starting at 1000(Hex), then Name = “Lew” Places the ASCII code for ‘L’ in 1000, and the code for ‘e’ in 1001…

Storing a String The ASCII table provides the codes: L – e – w –

Storing a String Memory locationContent Random junk ″ …

How are strings manipulated? Program design requirements can pose a number of problems that can be solved by string manipulation. Chapter 5 of the “Programming for Literacy” illustrates several examples.

Inspection Functions Function NameReturn typeDescription Len (String1)LongReturns a Long, the number of characters in String1 InStr ([Start (Integer),] String1, String2) LongReturns a Long specifying the position of the first occurrence of String2 in String1, starting at Start if the argument is specified, otherwise at the beginning of String1 InStrRev (String1, String2, [Start (Integer])) LongReturns a Long specifying the position of the first occurrence of String2 in String1, from the end of String1 (or from Start if the argument is specified StrComp (String1, String2)IntegerReturns an integer indicating the comparison of String1 and String2, namely -1, 0 or +1 depending if String1 is less than, equal to, or greater than String2

Conversion Functions Function NameReturn typeDescription Asc (String)IntegerReturns an Integer, being the character code for the first character in the string Chr (Long)StringReturns the character corresponding to the specified code Str (Long)StringReturns a string representation of the number LCase (String1)StringReturns String1 converted to lower case UCase (String1)StringReturns String1 converted to UPPER case

SubString Functions Function NameReturn typeDescription Left (String1, Integer)StringReturns a string containing the specified number of characters from the left of String1 Ltrim (String1)StringReturns a string with blanks removed from the left of String1 Right (String1, Integer)StringReturns a string containing the specified number of characters from the right of String1 Rtrim (String1)StringReturns a string with blanks removed from the right of String1 Mid (String1, Start (Long), [Length (Long)]) StringReturns all (or Length if it is specified) characters from String1 starting at position Start

String Creation Functions Function NameReturn typeDescription Space (Long)StringReturns a string composed of blanks, as many as specified by Long String (Long, String1)StringReturns a string composed of the first character of String1, repeated as many times as specified by Long StrReverse (String1)StringReturns a string composed of the characters from String1 but in reverse order Replace (String1, String2, String3, [Start (Long)], [Count]) StringReturns a string with String2 replaced by String3, where ever it is found in String1, beginning at position Start, or replaces it Count times from position Start