Manipulating Strings String Functions. VB provides a large number of functions that facilitate working with strings. These are found in Microsoft.VisualBasic.Strings.

Slides:



Advertisements
Similar presentations
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
Advertisements

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.
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.
On to… string operations & functions. Concatenation (&) §When we want to combine two character strings into one new (longer) string, we can concatenate.
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.
Chapter 9 Creating Formulas that Manipulate Text Microsoft Office Excel 2003.
Strings PART II STRING$ AND SPACE$. Create strings of specified number String$ creates string of specified character Space$ creates string of spaces Example:
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 9 More About Strings.
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,
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.
Manipulating Text In today’s lesson we will look at: why we might want to pick out parts of text strings some BASIC functions that can be used to chop.
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.
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.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Chapter 12: String Manipulation Introduction to Programming with C++ Fourth Edition.
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
Operations on Strings. 8/8/2005 Copyright 2006, by the authors of these slides, and Ateneo de Manila University. All rights reserved L: String Manipulation.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
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.
1 STRINGS String data type Basic operations on strings String functions String procedures.
H2K Infosys is business based in Atlanta, Georgia – United States Providing Online IT training services world wide. USA - +1-(770) ,
Strings The Basics. Strings a collection data type can refer to a string variable as one variable or as many different components (characters) string.
1 CSC 221: Introduction to Programming Fall 2012 Lists  lists as sequences  list operations +, *, len, indexing, slicing, for-in, in  example: dice.
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.
1 CSE 2337 Chapter 7 Organizing Data. 2 Overview Import unstructured data Concatenation Parse Create Excel Lists.
Tutorial 8: Manipulating Strings1 Tutorial 8 Manipulating Strings.
02/03/ Strings Left, Right and Trim. 202/03/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
Strings PART I STRINGS, DATES, AND TIMES. FUNDAMENTALS OF CHARATERS AND STRINGS VB represents characters using American National Standards Institute(ANSI)
CHAPTER FOUR Performing Calculations and Manipulating Data: Expressions.
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
There’s a particular style to it… Rob Hatton
CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.
Click to edit Master text styles Stacks Data Structure.
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.
String Manipulation. LENGTH(s) Returns the length(no. of char., including spaces) of string s E.g. S:=‘Computer Studies’; Writeln(Length(s)); Output :
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.
String Methods Programming Guides.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
SAS in Data Cleaning.
Winter 2018 CISC101 11/16/2018 CISC101 Reminders
SQL Text Manipulation Farrokh Alemi, Ph.D.
Manipulating Text In today’s lesson we will look at:
String Manipulation Chapter 7 Attaway MATLAB 4E.
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.
Microsoft Visual Basic 2005: Reloaded Second Edition
Microsoft Visual Basic 2005: Reloaded Second Edition
Topics Basic String Operations String Slicing
Introduction to Computer Science
Introduction to Computer Science
MapInfo SQL String Functions
Lecture 5 SQL FUNCTIONS.
Topics Basic String Operations String Slicing
Trainer: Bach Ngoc Toan– TEDU Website:
Topics Basic String Operations String Slicing
Introduction to SQL Server and the Structure Query Language
Presentation transcript:

Manipulating Strings String Functions

VB provides a large number of functions that facilitate working with strings. These are found in Microsoft.VisualBasic.Strings For convenience they can be grouped according to the kind of task they’re designed to carry out.

Inspection Functions Inspection functions take a string (or strings) as argument(s) and return information about them in numeric form.

Inspection Functions Function NameReturn typeDescription Asc (String1)IntegerReturns an Integer value representing the character code corresponding to a character. Len (String1)IntegerReturns an Integer, the number of characters in String1. InStr ([Start (Integer),] String1, String2) IntegerReturns an Integer 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])) IntegerReturns an Integer specifying the position of the first occurrence of String2 in String1, from the right 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 sorts ahead of, is the same as, or sorts later than String2.

Inspection Functions Len(“some text”) InStr(“some text”, “e”) InStr(“some text”, “a”) InStr(5, “some text”, “e”) InStrRev(“some text”, “e”) InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”) InStr(“some text”, “a”) InStr(5, “some text”, “e”) InStrRev(“some text”, “e”) InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”) InStr(5, “some text”, “e”) InStrRev(“some text”, “e”) InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”)0 InStr(5, “some text”, “e”) InStrRev(“some text”, “e”) InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”)0 InStr(5, “some text”, “e”)7 InStrRev(“some text”, “e”) InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”)0 InStr(5, “some text”, “e”)7 InStrRev(“some text”, “e”)7 InStrRev(“some text”, “e”, 5) StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”)0 InStr(5, “some text”, “e”)7 InStrRev(“some text”, “e”)7 InStrRev(“some text”, “e”, 5)4 StrComp(“text”, “test”)

Inspection Functions Len(“some text”)9 InStr(“some text”, “e”)4 InStr(“some text”, “a”)0 InStr(5, “some text”, “e”)7 InStrRev(“some text”, “e”)7 InStrRev(“some text”, “e”, 5)4 StrComp(“text”, “test”)1

Case Conversion Functions Function NameReturn typeDescription LCase (String1)StringReturns String1 converted to lower case UCase (String1)StringReturns String1 converted to UPPER case These are fairly obvious.

SubString Functions There are several functions provided to extract part of string. Function NameReturn typeDescription Left (String1, Length )StringReturns a string containing the specified number of characters from the left of String1. Right (String1, Length )StringReturns a string containing the specified number of characters from the right of String1. Mid (String1, Start, [Length]) StringReturns all (or Length if it is specified) characters from String1 starting at position Start.

Formatting Functions Function NameReturn typeDescription LSet (String1, Integer)StringReturns a left-aligned string containing String1 adjusted to the specified length. LTrim (String1)StringReturns a string with blanks removed from the left of String1 RSet (String1, Integer)StringReturns a right-aligned string containing String1 adjusted to the specified length. RTrim (String1)StringReturns a string with blanks removed from the right of String1

String Creation Functions Function NameReturn type Description Chr (Integer)CharReturns the character associated with the specified character code. Space (Integer)StringReturns a string composed of blanks, as many as specified by Integer. StrReverse (String1)StringReturns a string composed of the characters from String1 but in reverse order. Join (SourceArray() [,Delimiter]) StringReturns a string created by joining a number of substrings contained in an array. Is a character to be used to separate the strings. Replace (String1, String2, String3, [Start], [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.

String Creation Functions Replace (“some people”, “o”, “a”)

String Creation Functions Replace (“some people”, “o”, “a”) “same peaple”

String Creation Functions Replace (“some people”, “o”, “a”) “same peaple” Replace (“some people”, “o”, “a”,, 1)

String Creation Functions Replace (“some people”, “o”, “a”) “same peaple” Replace (“some people”, “o”, “a”,, 1) “same people”

String Creation Functions Replace (“some people”, “o”, “a”) “same peaple” Replace (“some people”, “o”, “a”,, 1) “same people” Replace (“some people”, “o”, “a”, 5)

String Creation Functions Replace (“some people”, “o”, “a”) “same peaple” Replace (“some people”, “o”, “a”,, 1) “same people” Replace (“some people”, “o”, “a”, 5) “ peaple” Notice that Start indicates the starting character for the Result string.