1 Comparing Strings zLcase(string) --- converts a string to lower case Mystring = lcase(yourstring) zUcase(string) --- converts a string to upper case.

Slides:



Advertisements
Similar presentations
Java Programming Strings Chapter 7.
Advertisements

0 PROGRAMMING IN HASKELL Chapter 9 - Interactive Programs.
1.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition
Chapter 9 Creating Formulas that Manipulate Text Microsoft Office Excel 2003.
Variables and Constants
Chapter 4: The Selection Structure
A453 Exemplar Password Program using VBA
Tutorial 11 Using and Writing Visual Basic for Applications Code
SPELLING GAME PROJECT SAMPLE ASSESSMENT MATERIAL GCSE Computing.
07/10/ Strings ASCII& Processing Strings with the Functions - Locate (Instr), Mid, Length (Len), Char (ChrW) & ASCII (Asc)
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
Strings CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
COMP 116: Introduction to Scientific Programming Lecture 24: Strings in MATLAB.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
STARTING OUT WITH STARTING OUT WITH Class 9 Honors.
String Manipulation. Strings have their own properties and methods, just like a textbox or label or form does.
Decisions and Debugging Part06dbg --- if/else, switch, validating data, and enhanced MessageBoxes.
Examples of comparing strings. “ABC” = “ABC”? yes “ABC” = “ ABC”? No! note the space up front “ABC” = “abc” ? No! Totally different letters “ABC” = “ABCD”?
Chapter 8: Manipulating Strings
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Decision Structures, String Comparison, Nested Structures
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
String operations. About strings To handle strings more easily, we need to include a library> #include To see what the library allows us to do, look here:
1. Comparing Strings 2. Converting strings/numbers 3. Additional String Functions Strings Built-In Functions 1.
EGR 115 Introduction to Computing for Engineers Branching & Program Design – Part 3 Friday 03 Oct 2014 EGR 115 Introduction to Computing for Engineers.
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
Microsoft Visual Basic 2012 CHAPTER FIVE Decision Structures.
Special Methods in Java. Mathematical methods The Math library is extensive, has many methods that you can call to aid you in your programming. Math.pow(double.
INLS 560 – S TRINGS Instructor: Jason Carter. T YPES int list string.
8 1 String Manipulation CGI/Perl Programming By Diane Zak.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 11 So Many Paths … So Little Time.
Tutorial 8: Manipulating Strings1 Tutorial 8 Manipulating Strings.
Python Strings. String  A String is a sequence of characters  Access characters one at a time with a bracket operator and an offset index >>> fruit.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
Selection Part 2 Using Logical Operators, how strings are compared and random numbers.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
CSC 162 Visual Basic I Programming. String Functions LTrim( string ) –Removes leading spaces from the left side of string RTrim( string ) –Removes trailing.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Java String Methods - Codehs
C++ Memory Management – Homework Exercises
Microsoft Visual Basic 2008: Reloaded Third Edition
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Generating Random Numbers
PROGRAMMING IN HASKELL
Strings Part 1 Taken from notes by Dr. Neil Moore
CHAPTER FIVE Decision Structures.
Decision Structures, String Comparison, Nested Structures
String Manipulation Part 2
Decision Structures, String Comparison, Nested Structures
More Loops.
4.1 Strings ASCII & Processing Strings with the Functions
Basic String Operations
Write a program that places the names of five different states in labels, and allows the user to enter guesses of the corresponding state capitals in textboxes.
PROGRAMMING IN HASKELL
String Processing 1 MIS 3406 Department of MIS Fox School of Business
Introduction to Computer Science
Strings Taken from notes by Dr. Neil Moore & Dr. Debby Keen
Presentation transcript:

1 Comparing Strings zLcase(string) --- converts a string to lower case Mystring = lcase(yourstring) zUcase(string) --- converts a string to upper case Mystring = ucase(yourstring)

2 Comparing Strings zStrconv(string, conversion) --- converts a string based on the value of “conversion” VbUpperCase VbLowerCase VbProperCase (1 st letter in each word to uppercase)

3 Comparing Strings zReturns the string modified based on the conversion selected Dim mystr as string Mystr = “summer fun” l1.text = strconv(mystr, vbpropercase) // Summer Fun

4 Comparing Strings zPRACTICE: (Thompson p.6-27 Exercise 4) Initials and Uppercase names. Do not need to determine the Initials and display on a label.

5 String manipulation zMicrosoft.VisualBasic.Left(string, length) --- returns the number of letters from the start of the string Mystr = “Summer" Left(mystr, 3) // Sum

6 String manipulation zMicrosoft.VisualBasic.Right(string, length) --- returns the number of letters from the end of the string Mystr = “Summer” Right(mystr, 3) // mer

7 String manipulation zMid(string, start,length) --- takes a string and returns the number of characters starting with START and for the LENGTH mystr = “Summer” l1.caption = mid(mystr, 2, 4) // umme

8 String manipulation zLen(string) --- returns the number of characters in a string Mystr = “Summer” Myint = Len(mystr) // 6

9 String manipulation zPRACTICE: (Thompson p.6-11 Review 6) display the first letter and last letter entered in a textbox.

10 String manipulation zInStr(start, string1, string2) – returns the starting position of a substring. z0 is returned if the substring is not found. zStart is the position in string1 to search for zString1 is the string to be searched zString2 is the string to be searched for Mystr = “Sumer” My2 = “um Intofpos = Istr(1, mystr, my2) // 2

11 String manipulation zPRACTICE: (Thompson p.6-12 Review 7) allow for entry of 2 strings in 2 textboxes, display the position of the 1 st word in which the 2 nd word (substring) is found zPRACTICE: (Thompson p.6-12 Review 8) enter a word and then a letter to search for, then display the number of times that letter appears in the word. zPRACTICE: (Thompson p.6-28 Exercise 9) Reverse an entered word.

12 String manipulation zStrcomp(string1, string2, vbTextCompare) does not care about case Example: Dim a, b as string A = “apples” B = “oranges” If strcomp(a, b, vbTextCompare) = 0 Then Words are the same Else Words are different End if

13 String manipulation zLike --- used to perform textual comparison on strings. zResult = string like pattern zResult is a bolean or integer: zTrue if string matches pattern zFalse if it does not match the pattern

14 String manipulation zExample: Pattern forms: ? single character * in place of many characters # single number [] list of characters - a range of characters in a character list, separate characters in a character list

15 String manipulation Mystr = “Run” Str = “ ?un” L1.caption = mystr Like str // caption = TRUE

16 String manipulation Mystr = “Run” Str = “ ?um” L1.caption = mystr Like str // caption = FALSE

17 String manipulation Mystr = “Letter to the Editor” Str = “ Letter to *” L1.caption = mystr Like str // caption = TRUE

18 String manipulation Mystr = “Case ” Str = “Case 977#” L1.caption = mystr Like str // caption = TRUE

19 String manipulation Mystr = “Case ” Str = “Case 9#6#” L1.caption = mystr Like str // caption = FALSE

20 String manipulation Mystr = “C” Str = “[A,B,C,D]” L1.caption = mystr Like str // caption = TRUE zMystr = “B” Str = “[A-D]” L1.caption = mystr Like str // caption = TRUE

21 String manipulation zPRACTICE: (Thompson p.6-29 Exercise 10) Create a program that counts and displays the number of the vowels in a word entered in a textbox.

22 String manipulation zPRACTICE:(thompson p.6-20 Case Study ) Create a “Hangman” program that allows a user to enter characters and guess a secret word. The application should then display a message if the user guessed the secret word correctly and how many tries it took...

23 String manipulation z...Create a caption that displays a dash for each letter in the word (use large font) zUse a random number to select from several words zStore the secret word in a string and the length of the word as an integer zStore the number of guesses in an integer...

24 String manipulation z...Within a loop, display an input box to guess a letter of the word and then search the secret word for any matching letters. If a letter matches, replace the dashes with the correct letters and ask for another letter.