Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Current Assignments Homework 5 will be available tomorrow and is due on Sunday. Arrays and Pointers Project 2 due tonight by midnight. Exam 2 on Monday.
Java Programming Strings Chapter 7.
CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf 9.4Printing Integers 9.5Printing Floating-Point.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
Tutorial 14 Working with Forms and Regular Expressions.
JavaScript, Fourth Edition
JavaScript, Third Edition
Chapter 7. 2 Objectives You should be able to describe: The string Class Character Manipulation Methods Exception Handling Input Data Validation Namespaces.
 2007 Pearson Education, Inc. All rights reserved C Formatted Input/Output.
Ceng 356-Lab2. Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort the.
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
XP Tutorial 14 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
Last Updated March 2006 Slide 1 Regular Expressions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Streams Streams –Sequences of characters organized.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
Tutorial 14 Working with Forms and Regular Expressions.
CS0004: Introduction to Programming Input and Output.
Input/Output Chapters 7 & 9. Output n Print produces output > (print 100) n It also returns the value it printed –that’s where the second 100 came.
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Chapter 9 Formatted Input/Output Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
 2005 Pearson Education, Inc. All rights reserved Formatted Output.
CS0004: Introduction to Programming Variables – Strings.
CSCI 3327 Visual Basic Chapter 12: Strings, Characters and Regular Expressions UTPA – Fall 2011.
Chapter 3: Data Types and Operators JavaScript - Introductory.
ASP.NET Programming with C# and SQL Server First Edition Chapter 5 Manipulating Strings with C#
Restricting and Sorting Data. ◦ Limiting rows with:  The WHERE clause  The comparison conditions using =,
2 Copyright © Oracle Corporation, All rights reserved. Restricting and Sorting Data.
4 Copyright © 2006, Oracle. All rights reserved. Restricting and Sorting Data.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
LECTURE 1 INTRODUCTION TO PL/SQL Tasneem Ghnaimat.
String Manipulation. Strings have their own properties and methods, just like a textbox or label or form does.
CN1266 Network Scripting V1.2 Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
Instructor: Craig Duckett Lecture 08: Thursday, October 22 nd, 2015 Patterns, Order of Evaluation, Concatenation, Substrings, Trim, Position 1 BIT275:
Chapter 12: String Manipulation Introduction to Programming with C++ Fourth Edition.
Functions and Arrays. Predefined Functions eval(condition) –Evaluates (executes) JavaScript syntax –Eval returns an undefined value parseInt(string) and.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
Chapter 7: Characters, Strings, and the StringBuilder.
2 第二讲 Restricting and Sorting Data. Objectives After completing this lesson, you should be able to do the following: Limit the rows retrieved by a query.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
Copyright © Curt Hill Regular Expressions Providing a Search Pattern.
Representing Strings and String I/O. Introduction A string is a sequence of characters and is treated as a single data item. A string constant, also termed.
1 Chapter 3 – Examples The examples from chapter 3, combining the data types, variables, expressions, assignments, functions and methods with Windows controls.
C++ for Engineers and Scientists Second Edition Chapter 7 Completing the Basics.
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.
2 Copyright © 2009, Oracle. All rights reserved. Restricting and Sorting Data.
CN2180 Chapter 4 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
XP Tutorial 7 New Perspectives on JavaScript, Comprehensive 1 Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
C How to Program, 7/e © by Pearson Education, Inc. All Rights Reserved.
JavaScript and Ajax (JavaScript Data Types) Week 2 Web site:
Computer Programming 2 Lab (1) I.Fatimah Alzahrani.
A FIRST BOOK OF C++ CHAPTER 14 THE STRING CLASS AND EXCEPTION HANDLING.
CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two.
Strings CSE 1310 – Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1.
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
Limiting Selected Rows. 2-2 Objectives Sort row output using the ORDER BY clause. Sort row output using the ORDER BY clause. Enter search criteria using.
String Manipulation Reference:
String Variable, Methods and Properties
String Variable, Methods and Properties
Restricting and Sorting Data
String Variable, Methods and Properties
String Variable, Methods and Properties
Python Strings.
Switch, Strings, and ArrayLists in Java
Presentation transcript:

Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+

 Chapter 7: Working on a Pipeline  Chapter 9: Bringing Strings into the Limelight

 When you take the output of one command and direct it to the input of another command  Try this on command prompt  Ipconfig | find “ipv4 address”  Dir c:\windows\system32 | find “.exe”

 Try this:  Get-childitem c:\windows\system32 | format- table  Get-childitem c:\windows\system32 | format- list  Get-childitem c:\windows\system32 | format- wide

 Cmdlets use out-default as a default format to shows the output  All object are returned to the command as a stream of data

 Get-process | format-table  Get-process | format-table –property id, name  Get-process | format-table –property name, id  Get-process | where-object {$_.Id –gt 1000} | format- table –property name, cpu, id  $_ refers to the current object in the pipe-line  Get-process | where-object {$_.Id –gt 1000} | select-object name, cpu, id | sort-object CPU, ID

 A technical name for text  A consecutive sequence of characters  Empty VS Null Strings  Empty string – a string with zero length  Null string – undefined string (no value, no length, nothing)

 A literal string is enclosed by double quotes  “this is the a literal string” +  “… so the story continues…”  Here-Strings  $RegularString = “First Line of string`n” +  “Second line `n” +  “Third line”  Write-host $RegularString

 Here-Strings  $MyHereString  First Line of string  Second line  Third line   Write-host $MyHereString  You also can use quotation in here-string

 + (Concatenation) – to combine string together  See code in Page 120  You can implicitly or explicitly convert the data type into string  See codes in Page 121

 Method split() is used to spilt the string into array of strings  $str = “this book is good!”  $str.split()

 $myIP = “ ”  $ipArr = $myIP.split(“.”)  Write-Host (“Number of elements in ipArr” + $ipArr.length)  Write-Host (“First octet: “ + $ipArr[0])  Write-Host (“Second octet: “ + $ipArr[1])  Write-Host (“Third octet: “ + $ipArr[2])  Write-Host (“Fourth octet: “ + $ipArr[3])

 $myIP = “ ,10;100”  $ipArr = $myIP.split(“.,;”)  Write-Host (“Number of elements in ipArr” + $ipArr.length)  Write-Host (“First octet: “ + $ipArr[0])  Write-Host (“Second octet: “ + $ipArr[1])  Write-Host (“Third octet: “ + $ipArr[2])  Write-Host (“Fourth octet: “ + $ipArr[3])

 Method substring()  $name = “Steve Seguis”  $part1 = $name.substring(0,3)  $part2 = $name.substring($name.length-4,4)  Write-Host ($part1 + $part2)

 $str = “Steve is EVIL!!!”  $newstr = $str.replace(“EVIL”,”Good~”)  Write-Host $newstr

 Method IndexOf() is used to find the specific character in the string  $ =  $atpos =  $user = $ .substring(0, $atpos)  $domain = $ .substring($atpos+1, $ .length-($atpos+1))  Write-Host (“Username: “ + $user)  Write-Host (“Domain: “ + $domain)

 $ = “My_invalid_ _address”  If –lt 0){  Write-Host “Invalid address!”  }else{  Write-Host “Valid address!”  }

 Upper case  ToUpper() method  Lower case  ToLower() method

 A search pattern  [RegEx]::IsMatch(“This book is really interesting.”,”book”)  [RegEx]::IsMatch(“I have 2 siblings”,”[0-9]”)  *NOTE* It is case sensitive

 You can use escape string (\) if you want to search for special character on page 129  [RegEx]::IsMatch(“Visit us at dummies.com”,”dummies\.com”) . (dot) is a single-character wildcard  [RegEx]::IsMatch(“bell”,”.ell”)

 $username = “testuser1”  [RegEx]::IsMatch($username, “testuser[0-9]”)  If you want the name to end with either ‘a’ or ‘e’  $name = “Anna”  [RegEx]::IsMatch($name,”Ann[ae]”)

 If you want to exclude character from a match, you can negate a character set by prefixing it with the caret (^)  [RegEx]::IsMatch(“food”,”[^fh]ood”)  See Table 9-1 on Page 131 for more information

 Question mask (?) indicates that the preceding character can exist zero times or one time  [RegEx]::IsMatch(“favorite”,”favou?rite”)  [RegEx]::IsMatch(“favourite”,”favou?rite”)  [RegEx]::IsMatch(“Monday”,”Mon(day)?”)

 Plus (+) operator indicates that the preceding character can exist one or more times  [RegEx]::IsMatch(“srvfile1”,”srv[a-z0-9]+”)  [RegEx]::IsMatch(“srvfile1”,”srv[a-z]+[0-9]”)  [RegEx]::IsMatch(“Monday”,”Mon(day)?”)

 star (*) operator indicates that the preceding character can exist zero times or more times  [RegEx]::IsMatch(“Ann”,”Ann[a-z]*”)  Repetitve Format  [RegEx]::IsMatch(“96813”,”[0-9] [0-9] [0-9] [0-9] [0-9]”  [RegEx]::IsMatch(“96813”,”[0-9] {5}”

 Repetitve Format  [RegEx]::IsMatch(“96813”,”[0-9] [0-9] [0-9] [0-9] [0-9]”  [RegEx]::IsMatch(“96813”,”[0-9] {5}”  [RegEx]::IsMatch(“USERA”,”USER[A-Z]{2,5}”)  Ends in a sequence of two to five upper case letters

 ^ - the match must occur at the beginning of the string  [RegEx]::IsMatch(“SRVFILE1”,”^SRV[A-Z]+[0-9]”)  [RegEx]::IsMatch(“TESTSRVFILE1”,”^SRV[A-Z]+[0- 9]”)

 $- the match must occur at the end of the string  [RegEx]::IsMatch(“SRVFILE1”,”SRV[A-Z]+[0-9]$”)  [RegEx]::IsMatch(“TESTSRVFILE1”,”SRV[A-Z]+[0- 9]$”)  [RegEx]::IsMatch(“SRVFILE1TEST”,”SRV[A-Z]+[0- 9]$”)

 [RegEx]::IsMatch(“Dummies.com”,”[A-za-z0- 9]+\.(com|edu|net)”)

 $ =  If ($ –match  Write-Host “$ is a dummies.com address”  }

 $str = “Visit us at  $newstr = $str –replace “www\.[A-za-z0- 9]+\.(com|edu|net)”,”WEBSITE NAME KEPT SECRET”  Write-Host $newstr