1.10 Strings academy.zariba.com 1. Lecture Content 1.What is a string? 2.Creating and Using strings 3.Manipulating Strings 4.Other String Operations 5.Building.

Slides:



Advertisements
Similar presentations
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 9 Strings.
Advertisements

Chapter 7 Strings F To process strings using the String class, the StringBuffer class, and the StringTokenizer class. F To use the String class to process.
1 Strings and Text I/O. 2 Motivations Often you encounter the problems that involve string processing and file input and output. Suppose you need to write.
Chapter 7 Strings F Processing strings using the String class, the StringBuffer class, and the StringTokenizer class. F Use the String class to process.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 8 Strings.
Java Programming Strings Chapter 7.
Character sequences, C-strings and the C++ String class, Working with Strings Learning & Development Team Telerik Software Academy.
 Basically, a sequence of characters  Character? › Like… a letter › Or a number › Or even blank space.
An Introduction to Programming with C++ Fifth Edition Chapter 12 String Manipulation.
 Pearson Education, Inc. All rights reserved Strings, Characters and Regular Expressions.
1.9 Methods academy.zariba.com 1. Lecture Content 1.What is a method? Why use methods? 2.Void Methods and methods with parameters 3.Methods which return.
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
2.3 Cool features in C# academy.zariba.com 1. Lecture Content 1.Extension Methods 2.Anonymous Types 3.Delegates 4.Action and Func 5.Events 6.Lambda Expressions.
Fall 2004COMP 3351 Languages. Fall 2004COMP 3352 A language is a set of strings String: A sequence of letters/symbols Examples: “cat”, “dog”, “house”,
1.7 Arrays academy.zariba.com 1. Lecture Content 1.Basic Operations with Arrays 2.Console Input & Output of Arrays 3.Iterating Over Arrays 4.List 5.Cloning.
Lesson 3 – Regular Expressions Sandeepa Harshanganie Kannangara MBCS | B.Sc. (special) in MIT.
Mathcad Variable Names A string of characters (including numbers and some “special” characters (e.g. #, %, _, and a few more) Cannot start with a number.
Characters, String and Regular expressions. Characters char data type is used to represent a single character. Characters are stored in a computer memory.
Computer Programming for Biologists Class 5 Nov 20 st, 2014 Karsten Hokamp
CSCI 3327 Visual Basic Chapter 12: Strings, Characters and Regular Expressions UTPA – Fall 2011.
ASP.NET Programming with C# and SQL Server First Edition Chapter 5 Manipulating Strings with C#
1.3 Console Input And Output academy.zariba.com 1.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 9 Strings and Text.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:
An Introduction to Java Programming and Object-Oriented Application Development Chapter 7 Characters, Strings, and Formatting.
String Manipulation. Strings have their own properties and methods, just like a textbox or label or form does.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
1.5 Conditional Statements academy.zariba.com 1. Lecture Content 1.If-else statements 2.If-else-if statements 3.Switch-case statements 2.
Overview A regular expression defines a search pattern for strings. Regular expressions can be used to search, edit and manipulate text. The pattern defined.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
When you read a sentence, your mind breaks it into tokens—individual words and punctuation marks that convey meaning. Compilers also perform tokenization.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
CSCI 3327 Visual Basic Chapter 12: Strings, Characters and Regular Expressions UTPA – Fall 2011.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 8: Fun with strings.
String String Builder. System.String string is the alias for System.String A string is an object of class string in the System namespace representing.
CSI 3125, Preliminaries, page 1 String. CSI 3125, Preliminaries, page 2 String Class Java provides the String class to create and manipulate strings.
1 String Processing CHP # 3. 2 Introduction Computer are frequently used for data processing, here we discuss primary application of computer today is.
Strings and Related Classes String and character processing Class java.lang.String Class java.lang.StringBuffer Class java.lang.Character Class java.util.StringTokenizer.
More Sequences. Review: String Sequences  Strings are sequences of characters so we can: Use an index to refer to an individual character: Use slices.
1.2 Primitive Data Types and Variables
Strings Methods in the String class Manipulating text in Java.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
1.8 Multidimensional Arrays academy.zariba.com 1.
Lab String Concatenation String s3 = s1.concat(s2); String s3 = s1 + s2; s1 + s2 + s3 + s4 + s5 same as (((s1.concat(s2)).concat(s3)).concat(s4)).concat(s5);
Perl: Practical Extraction & Reporting Language RL Schwartz, Learning Perl, RL Schwartz & L Wall, Programming Perl, O’Reilly & Associates.
13/06/ Strings Left, Right and Trim. 213/06/2016 Learning Objectives Explain what the Left, Right and Trim functions do.
ENGINEERING 1D04 Tutorial 2. What we’re doing today More on Strings String input Strings as lists String indexing Slice Concatenation and Repetition len()
Strings and Text Processing
C++ Memory Management – Homework Exercises
String Methods Programming Guides.
COMPSCI 107 Computer Science Fundamentals
Computer Programming ||
Strings, Characters and Regular Expressions
Strings, Characters and Regular Expressions
2.2 Defining Classes Part 2 academy.zariba.com.
JavaScript OOP academy.zariba.com.
Part a: Fundamentals & Class String
Bryan Burlingame 17 October 2018
Tonga Institute of Higher Education
Topics discussed in this section:
Basic String Operations
Topics Basic String Operations String Slicing
Bryan Burlingame 13 March 2019
Introduction to Computer Science
Topics Basic String Operations String Slicing
Exam Prep.
Languages Fall 2018.
Topics Basic String Operations String Slicing
Unit-2 Objects and Classes
What We Want To Do User enters: Mary Smith
Presentation transcript:

1.10 Strings academy.zariba.com 1

Lecture Content 1.What is a string? 2.Creating and Using strings 3.Manipulating Strings 4.Other String Operations 5.Building strings 6.Formatting Strings 2

1. What is a string? 3 Strings are sequences of characters. Each character is a Unicode symbol. String objects in C# are immutable(read-only). Strings are like arrays of character. Have a fixed length. Characters can be accessed by index

2. Creating and Using Strings 4

3. Manipulating strings 5 Comparing, concatenating, searching, splitting etc.

4. Other String Operations 6 Replacing and deleting substrings, changing character casing, trimming.

5. Building Strings 7 Using the “+” operator to build strings is slow. This is why there is StringBuilder.

6. Formatting String 8

Homework 9 1. Write a program that reads a string, reverses it and prints the result at the console. Do NOT use any built in methods! 2. Write a program to check if in a given expression the brackets are put correctly. Correct:((x-y)/(10-z)). Incorrect: )(x*y)-1). 3. Write a program that finds how many times a substring is contained in a given text (perform case insensitive search). 4. Write a program that reads from the console a string of maximum 20 characters. If the length of the string is less than 20, the rest of the characters should be filled with '*'. Print the result string into the console. 5. Write a program that extracts from a given text all sentences containing given word.

Homework 10 6.Write a program that reverses the words in given sentence. 7.Write a program that extracts from a given text all sentences containing given word. 8.Write a program that extracts from a given text all palindromes, e.g. “level", “stats", “radar". 9.Write a program that reads a string from the console and prints all different letters in the string along with information how many times each letter is found. 10.Write a program that reads a string from the console and lists all different words in the string along with information how many times each word is found. 11.Write a program that reads a string from the console and replaces all series of consecutive identical letters with a single one. Example: “zzzzzaaaarrrriiiiiiiibbbbbbbaaaaa"  “zariba".

11 References

12 Zariba Academy Questions