Do-more Technical Training

Slides:



Advertisements
Similar presentations
Character Arrays (Single-Dimensional Arrays) A char data type is needed to hold a single character. To store a string we have to use a single-dimensional.
Advertisements

 2003 Prentice Hall, Inc. All rights reserved Fundamentals of Characters and Strings Character constant –Integer value represented as character.
Strings.
Lecture 9. Lecture 9: Outline Strings [Kochan, chap. 10] –Character Arrays/ Character Strings –Initializing Character Strings. The null string. –Escape.
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.
Chapter 8 Characters and Strings Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Input/Output  Input/Output operations are performed using input/output functions  Common input/output functions are provided as part of C’s standard.
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
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.
 Pearson Education, Inc. All rights reserved Formatted Output.
C Tokens Identifiers Keywords Constants Operators Special symbols.
You gotta be cool. Stream Stream Output Stream Input Unformatted I/O with read, gcount and write Stream Manipulators Stream Format States Stream Error.
Chapter 3 Processing and Interactive Input. 2 Assignment  The general syntax for an assignment statement is variable = operand; The operand to the right.
Input, Output, and Processing
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
 Character set is a set of valid characters that a language can recognise.  A character represents any letter, digit or any other sign  Java uses the.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
Chapter 5 Strings CSC1310 Fall Strings Stringordered storesrepresents String is an ordered collection of characters that stores and represents text-based.
CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 21 Thanks for Lecture Slides:
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.
Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize.
Strings and Related Classes String and character processing Class java.lang.String Class java.lang.StringBuffer Class java.lang.Character Class java.util.StringTokenizer.
Files A collection of related data treated as a unit. Two types Text
17-Mar-16 Characters and Strings. 2 Characters In Java, a char is a primitive type that can hold one single character A character can be: A letter or.
Principles of Programming - NI Chapter 10: Character & String : In this chapter, you’ll learn about; Fundamentals of Strings and Characters The difference.
Do-more Technical Training Instruction Set (String)
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Do-more Technical Training Instruction Set (Misc/Data Manipulation)
Do-more Technical Training
Data Representation COE 308 Computer Architecture
28 Formatted Output.
Do-more Technical Training
NUMBER SYSTEMS.
Data Representation ICS 233
Lec 3: Data Representation
Topics Designing a Program Input, Processing, and Output
Data Representation.
Do-more Technical Training
C Characters and Strings
Strings, Characters and Regular Expressions
Strings, StringBuilder, and Character
ECE Application Programming
Containers and Lists CIS 40 – Introduction to Programming in Python
University of Central Florida COP 3330 Object Oriented Programming
TMF1414 Introduction to Programming
Chapter 8 - Characters and Strings
Defining Types of data expression Dn [name] expression Dn [name]
Chapter 2 part #3 C++ Input / Output
Input and Output Lecture 4.
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
Data Representation COE 301 Computer Organization
Ken D. Nguyen Department of Computer Science Georgia State University
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Lecture 13 Input/Output Files.
String Manipulation Chapter 7 Attaway MATLAB 4E.
Data Representation ICS 233
Topics Designing a Program Input, Processing, and Output
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
Topics Designing a Program Input, Processing, and Output
Introduction to Computer Science
Inside Module 8 Extracting Data Page Using the Extract command 2
Chapter 2 part #3 C++ Input / Output
Ken D. Nguyen Department of Computer Science Georgia State University
Data Representation COE 308 Computer Architecture
ECE 120 Midterm 1 HKN Review Session.
Presentation transcript:

Do-more Technical Training Instruction Set (String)

Instruction Set (String) STR2INT “Convert String to Integer” Converts ASCII digits to integer value Parameters: Input String – string to be converted Input Radix – determines valid characters Decimal (base 10): characters “0-9” Hexadecimal (base 16): characters “0-F” Octal (base 8): characters “0-7” Implied Base: characters “0x” (hex), “0” (octal), “1-9”(decimal) Other (2-36): e.g. 36 would validate characters “0-Z” Numeric Output – location of converted value Index Where Stopped – character location in string NOTES: If Input String is empty then Index Where Stopped = -1; ERR = “STR2INT input string is empty” If Input String contains invalid characters then Index Where Stopped = -1; ERR = “STR2INT input string couldn’t be converted to an integer value” SS0 1 2 3 4 5 6 7 8 SS0 1 2 3 4 5 6 7 8 F SS0 1 2 3 4 5 6 7 8 @ SS0 1 2 3 4 5 6 7 8 SS0 1 2 3 4 5 6 7 8 Input Radix Numeric Output Index Where Stopped Decimal -1 Hexadecimal Octal Implied Base Other: 20 Input Radix Numeric Output Index Where Stopped Decimal 1 4 Hexadecimal 31 5 Octal Implied Base “Decimal”  1 Other: 20 35 Input Radix Numeric Output Index Where Stopped Decimal 10 2 Hexadecimal 16 Octal 8 Implied Base “Decimal”  10 Other: 20 20 Input Radix Numeric Output Index Where Stopped Decimal -1 Hexadecimal Octal Implied Base Other: 20 Input Radix Numeric Output Index Where Stopped Decimal 10 5 Hexadecimal 16 Octal 8 Implied Base “Decimal”  10 Other: 20 20

Instruction Set (String) STR2REAL “Convert String to Real” Converts ASCII digits to real value Parameters: Input String – string to be converted Numeric Output – location of converted value Index Where Stopped – character location in string NOTES: Valid characters are: “0123456789.E+-” If Input String is empty then Index Where Stopped = -1; ERR = “STR2REAL input string is empty” If Input String contains invalid characters then Index Where Stopped = -1; ERR = “STR2REAL input string couldn’t be converted to an integer value” SS0 1 2 3 4 5 6 7 8 9 - . SS0 1 2 3 4 5 6 7 8 9 . SS0 1 2 3 4 5 6 7 8 9 + . E SS0 1 2 3 4 5 6 7 8 9 Numeric Output Index Where Stopped 0.0 -1 Numeric Output Index Where Stopped 6.02E+23 9 Numeric Output Index Where Stopped 1.0 4 Numeric Output Index Where Stopped -3.14 8

Instruction Set (String) STRCASE “Convert String to UPPER/lower Case” Converts all characters in a string to either upper case or lower case letters Parameters: Input/Output String – string to be converted Convert to: all lower case ALL UPPER CASE NOTES: Valid characters are only alphabetic letters If character is not alphabetic, no change occurs to that character SS0 a b c d ! E F g H Low Up SS0 a b c d ! e f g h SS0 A B C D ! E F G H

Instruction Set (String) STRCLEAR “Clear Strings” Deletes all characters from a single string or a range of strings Parameters: Start String – 1st (or only) string to be cleared Number of Strings to Clear – 1 to 65535 (or variable) NOTES: The Status display will only show as many characters that fit in its borders (about 50 characters)

Instruction Set (String) E = 45 hex STRCMP “String Compare” Compares two strings to determine if they are equal, less than or greater than Less than & greater than values are determined by the ASCII byte values Each byte position is compared until: Byte values don’t match with one value > or < End of one string reached 1st meaning it is < End of both strings reached simultaneously meaning equality Parameters: First String Case Sensitive: Yes, upper/lower case are different No, upper/lower case are equal Set If Equal (optional) Set If Less Than (optional) Set If Greater Than (optional) Second String or Text – the 2nd string can be a literal text in quotes Input Leg: Edge triggered Power flow enabled SS0 a b c d ! E F g H SS1 e SS0 a b c d ! E F g H SS1 SS0 a b c d ! E F g H SS1 e = 65 hex SS0’s E is < SS1’s e Yes, upper/lower case are different SS0 = SS1 SS0 < SS1 SS0 > SS1 YES No, upper/lower case are equal Yes, upper/lower case are different SS0 = SS1 SS0 < SS1 SS0 > SS1 YES No, upper/lower case are equal Yes, upper/lower case are different SS0 = SS1 SS0 < SS1 SS0 > SS1 YES No, upper/lower case are equal SS0’s E & SS1’s e are equal in value & SS0 is longer

Instruction Set (String) STRDELETE “Delete Substring” Deletes characters from a string Trailing characters are shifted to take the place of deleted ones Parameters: Input / Output String Starting at Offset: 0 – 1023 (or variable) The 1st character is 0 (zero) Number of Characters to Delete To delete the ! character: Starting at Offset = 4 Number of Characters to Delete = 1 SS0 a b c d ! E F g H SS0 a b c d E F g H 1 2 3 4

Instruction Set (String) STRFIND “Find within String” Search a target string for a particular string If successful the where-found offset could be used in STRSUB, STRDELETE or STRINSERT instructions Parameters: Find within – string in which to search Search from: Beginning to end End to beginning Case Sensitive: Yes, upper/lower case are different No, upper/lower case are equal In Offset: Start / Out Offset: Where Found – will contain -1 if nothing is found Set if found (optional) Set if NOT found (optional) Find Text/String: Exact sequence Any one of these characters – text box Input Leg: Edge triggered / Power flow enabled To find the E character: Search from: Beginning to end Case Sensitive: Yes Find Text/String: Any one of these characters: “E” SS0 a b c e E F g H 1 2 3 4

Instruction Set (String) STRPUTB “Put Bytes Into a String” Puts bytes of data from a specified location range into a string Parameters: Put Into String – string that will contain data bytes Start at Index – 1st location in the string for the bytes Length in Bytes – number of bytes to write into string From Starting Element – 1st location to read bytes <Create Byte Buffer> button – convenient way to create a Memory Block of bytes (shows up in Memory Configuration) NOTES: Not intended to operate on strings with ASCII text

Instruction Set (String) Values are manually written to a custom byte memory MyBuffer10-13. STRGETB “Get Bytes Out of a String” Extracts bytes of data out of a string & stores them in specified location Parameters: Get out of String – string with data bytes Start at Index – 1st location in the string for the bytes Length in Bytes – number of bytes to copy Into Starting Element – 1st location to put extracted bytes <Create Byte Buffer> button – convenient way to create a Memory Block of bytes (shows up in Memory Configuration) NOTES: Not intended to operate on strings with ASCII text The STRPUTB writes the range MyBuffer10-13 into SS0 ASCII values of 10, 20, 30 are not displayable characters. 40 decimal ASCII is (. The STRGETB writes the bytes in SS0 to the range MyBuffer0-3

Instruction Set (String) STRINSERT “Insert Substring” Inserts characters into a string Parameters: Insert String or Text Into String Starting at Offset If > length of string, it is appended to string If > allowable size of the Into String, then: Text is appended to string $OutOfRange (ST132) = ON ERR = “Argument out of range in STRINSERT…” The text “not ” is to be inserted into SS0 starting at offset 12.

Instruction Set (String) STRPRINT “Print to String” Writes text & formatted data into a string Parameters: Print to Append to String (optional) Automatically insert space after each term (optional) Print Script – text with optional embedded fields (text, control characters, strings, elements, formatting & string selection functions, raw data) – See next slide  Input Leg – Edge triggered / Power flow enabled

Instruction Set (Ethernet) STRPRINT “Print to String” Parameters: Print Script String Literals – ASCII text in double quotes (e.g. “Hi!”) Data Elements – (e.g. “The current count is” CT0.Acc) Control Characters $$  $ $”  “ $L  <LF> (line feed) $N  <CR><LF> (carriage return, line feed) $P  <FF> (form feed) $R  <CR> (carriage return) $T  <TAB> (tab) $hh  hh (any one-byte hex value) Formatting Functions [see Do-more Designer Help Topic DMD0168] FmtString – Sets length and/or justifies text within a string FmtBit – Formats bits’ values as a text instead of just 0 or 1 FmtInt – Formats how an integer is represented in a string FmtReal – Formats how real numbers are represented in a string FmtTMR – Formats how Timer Accumulator values are represented in a string FmtDate – Formats how a Date stamp is represented in a string FmtTime – Formats how a Time stamp is represented in a string Lookup – Selects a string in a list to represent a value Raw – Places bytes of data from a data block into a string

Instruction Set (String) STRSUB “Get Sub-String” Copies characters from one string to another Parameters: Input String Starting Offset Offset From – Beginning / End Length – variable or Remainder of input string Output String Input Leg – Edge triggered / Power flow enabled

Instruction Set (String) STRTRIM “Trim Whitespace” Removes all whitespace characters from the beginning and/or end of a string What is “Whitespace”?  Space (ASCII 20 hex) Horizontal tab <TAB> (ASCII 09 hex) Carriage return <CR> (ASCII 0D hex) Line feed <LF> (ASCII 0A hex) Form feed <FF> (ASCII 0C hex) Vertical tab <VT> (ASCII 0B hex) Parameters: String Trim Leading (optional) Trailing (optional)

Instruction Set (String) STRTRUNC “Set String Length” Sets the length of a string Parameters: String Length If 0 (zero) or negative (-) clears string <empty string> If > string’s length then string is padded with nulls (0; not spaces) to reach the specified length If > string’s allowed length (e.g. >64 for SS, >256 for SL) then entire string is padded with nulls (0; not spaces) and… $BufferOverflow (ST140) = ON ERR: “Length was greater than max string length in STRTRUNC…”