Manipulating Characters In today’s lesson we will look at: how text is stored inside the computer how we can use BASIC functions to manipulate and encipher.

Slides:



Advertisements
Similar presentations
Communications.
Advertisements

Digital electronics allow us to manipulate all types of information as digits (1s and 0s) in order to store and manage the information more efficiently.
Martin Bates Elsevier 2008 Programming 8-bit PIC Microcontrollers in C.
University of Washington CSE351 Announcements:  HW0, having fun?  Use discussion boards!  Sign up for mailing list  If you enrolled recently,
Representing Information as Bit Patterns
بسم الله الرحمن الرحيم معالج الحروف الضوئي OCR. Introduction Definition : OCR stands for O ptical C haracter R ecognition refers to the branch of computer.
© BYU 02 NUMBERS Page 1 ECEn 224 Binary Number Systems and Codes.
What is the ASCII Code? The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet.
Bits & Bytes: How Computers Represent Data
Representing Information Digitally. Digitization Initially transforming data for computer use Assigning people social security numbers The creation of.
Data Representation S2. This unit covers how the computer represents- Numbers Text Graphics Control.
Computer Structure & Architecture 7c - Data Representation.
Skill Area 311 Part A. Lecture Overview Binary Numbers Binary Arithmetic ASCII Code Machine Code Instruction Format Advantages and disadvantages of machine.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
The char Data Type A char is a one byte integer type typically used for storing characters. Example: char oneLetter = ’D’; We enclose the character in.
Fill in the blanks: (1) _________ has only two possible values 0 and 1. (2) There are __________bits in a byte. (3) 1 kilobyte of memory space can store.
Lecture 4: Number Systems (Chapter 3) (1) Data TypesSection3-1 (2) ComplementsSection3-2 (3) Fixed Point RepresentationsSection3-3 (4) Floating Point RepresentationsSection3-4.
Information Representation. Reading and References Reading - Computer Organization and Design, Patterson and Hennessy Chapter 2, sec. 2.4, 2.9 (first.
What is a computer? A computer is a device that:
University of Washington Memory, Data & Addressing The Hardware/Software Interface CSE351 Winter 2013.
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.
Computers in Libraries LIBR 56 Anthony Costa –
Agenda Last class: Memory, Digitizing Numbers Today: Digitizing: Text
November 18, 2015Memory and Pointers in Assembly1 What does this C code do? int foo(char *s) { int L = 0; while (*s++) { ++L; } return L; }
Representing Characters in a computer Pressing a key on the computer a code is generated that the computer can convert into a symbol for displaying or.
Data Representation, Number Systems and Base Conversions
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
General Purpose Packages DATA TYPES. Data Types Computer store information in the form of data. Information has meaning. Eg 23 May 2005 Data has no meaning.
String Manipulation By Felix Thompson, Jerzy Griffiths and Joel Sutcliffe.
Data Representation.
1 Problem Solving using Computers “Data....Representation, and Storage.
Files in Python The Basics. Why use Files? Very small amounts of data – just hardcode them into the program A few pieces of data – ask the user to input.
HNC COMPUTING - COMPUTER PLATFORMS 1 Micro Teach Binary.
Number Systems. ASCII – American Standard Code for Information Interchange – Standard encoding scheme used to represent characters in binary format on.
Software Design and Development Storing Data Part 2 Text, sound and video Computing Science.
June 14, 2016Machine Language and Pointers1 What does this C code do? int foo(char *s) { int L = 0; while (*s++) { ++L; } return L; }
Data Representation. In our everyday lives, we communicate with each other using analogue data. This data takes the form of: Sound Images Letters Numbers.
DATA Unit 2 Topic 2. Different Types of Data ASCII code: ASCII - The American Standard Code for Information Interchange is a standard seven-bit code that.
1.4 Representation of data in computer systems Character.
ENGINEERING 1D04 Tutorial 2. What we’re doing today More on Strings String input Strings as lists String indexing Slice Concatenation and Repetition len()
By the end of this session you should be able to... Understand character sets and why these are used within computer systems. Understand how characters.
Chapter 1 Introduction Digital Systems Digital systems: computation, data processing, control, communication, measurement - Reliable, Integration.
Text and Images Key Revision Points.
Storing Graphics Nat 5 Data Representation Lesson 4a: Storing Graphics
Chapter 8 & 11: Representing Information Digitally
Chapter 3 - Binary Numbering System
Unit 5 Lesson 6: User Input and Strings
1-1 Logic and Syntax A computer program is a solution to a problem.
Data Transfer ASCII FILES.
BTEC NCF Dip in Comp - Unit 02 Fundamentals of Computer Systems Lesson 10 - Text & Image Representation Mr C Johnston.
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
Intermediate 2 Computing
Breaking the Code Can anyone guess the phrase from this “code”?
Data Encoding Characters.
Data Representation ASCII.
Folders out, planners out…
Representing Characters
Computer Data Types Basics of Computing.
Manipulating Characters
Lesson 6: User Input and Strings
Presenting information as bit patterns
Digital Encodings.
Half Term 1 Please type your name here:.
Types of Data Ian Gover Education Technology Adviser
functions: argument, return value
Learning Intention I will learn how computers store text.
7 – Variables, Input and Output
Computer Systems Nat 4/5 Data Representation Lesson 4:
WJEC GCSE Computer Science
ASCII and Unicode.
Presentation transcript:

Manipulating Characters In today’s lesson we will look at: how text is stored inside the computer how we can use BASIC functions to manipulate and encipher text

All types of data are stored inside the computer as numbers: –for images, the number represents the colour of each pixel –for sound, the number represents how loud the sound is for each fraction of a second –for text, a numerical code is stored that represents each character The most common method for coding text on a PC is called ASCII – the American Standard Code for Information Interchange How Is Text Stored?

ASCII Codes ASCIISymbolASCIISymbolASCIISymbolASCIISymbolASCIISymbolASCIISymbol 33!49165A81Q97a113q 34"50266B82R98b114r 35#51367C83S99c115s 36$52468D84T100d116t 37%53569E85U101e117u 38&54670F86V102f118v 39'55771G87W103g119w 40(56872H88X104h120x 41)57973I89Y105i121y 42*58:74J90Z106j122z 43+59;75K91[107k123{ 44,60<76L92\108l124| 45-61=77M93]109m125} 46.62>78N94^110n126~ 47/63?79O95_111o127

The ASC() function takes a character and returns the corresponding ASCII code. For example: PRINT ASC(“A”) PRINT ASC(LEFT$(“Hello”, 1)) The output of these two lines of code is 65 and 72 respectively. The ASC Function

The CHR$() function takes an ASCII code and returns the corresponding character. For example: PRINT CHR$(65) PRINT CHR$(ASC(“a”)-32) The output of these two lines of code is A in both cases. The CHR$ Function

e.g. How would you capitalise a name? input "What is your name? "; n$ if asc(left$(n$,1))>96 then n$ = chr$(asc(left$(n$,1))-32) + right$(n$, len(n$)-1) print "Did you mean "; n$; "?" else print "Hello "; n$; ", nice to meet you!" end if Combining the Techniques