March 2005 1R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class More on StringsMore on Strings Strings reviewStrings review Character.

Slides:



Advertisements
Similar presentations
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Lab Status?Lab Status? Stuff from the readingStuff from the reading.
Advertisements

March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Tomorrow’s ExamTomorrow’s Exam Today’s LabToday’s Lab SortingSorting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Three exam questionsThree exam questions Lab with filesLab with.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Vectors and DimensionsVectors and Dimensions Scripts (shell scripts)Scripts.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reading numbers from dialogsReading numbers from dialogs Converting.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class AdministrativeAdministrative –Project proposals –This week’s lab Notes.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Designing Graphical ObjectsDesigning Graphical Objects The ‘divide.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Lab 16Lab 16 Filling in an arrayFilling in an array Searching for a.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class More about FunctionsMore about Functions RecursionRecursion.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class IF StatementIF Statement Revisiting assignment statementsRevisiting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Hard Drives – more laterHard Drives – more later MethodsMethods.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam TopicsExam Topics.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The project assignment, againThe project assignment, again Arrays.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Functions and Array ArgumentsFunctions and Array Arguments ExamExam.
March R. Smith - University of St Thomas - Minnesota Today’s Class Course StuffCourse Stuff –Classroom change TOMORROW –Assignment; Lab While LoopsWhile.
March R. Smith - University of St Thomas - Minnesota Today’s Class RecapRecap More course thingsMore course things Work on labs/projectsWork on labs/projects.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class GradingGrading The examThe exam Sorting arraysSorting arrays Pointers,
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Where we areWhere we are Strings and TextStrings and Text ConditionalsConditionals.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Final Exam ReviewFinal Exam Review –Assessment –Exam Format –C –Matlab.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Exam StatusExam Status Recap of Lab 7 ExampleRecap of Lab 7 Example.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class I/O ObjectsI/O Objects Lab 12Lab 12.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Young Scholars GrantsYoung Scholars Grants Exam Next TuesdayExam Next.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Today’s LabToday’s Lab SortingSorting.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Reviewing previous workReviewing previous work Using a dialog boxUsing.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class End of Chapter 2: READ Section 2.15End of Chapter 2: READ Section.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The ProjectThe Project PointersPointers.
March R. Smith - University of St Thomas - Minnesota CISC Class Today Return Homework; grading recapReturn Homework; grading recap “Enigma”
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Class projectsClass projects Lab 13: Use the method documentation.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today Finish the other presentationFinish the other presentation Cipher ModesCipher.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230 – Today in Class Getting Homework BackGetting Homework Back DecimalFormat class.
6/22/2015 1R. Smith - University of St Thomas - Minnesota QMCS Class Today St. Lukes Case StudySt. Lukes Case Study.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today Working the InternetWorking the Internet RoutingRouting Firewalling in.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Return HomeworkReturn Homework Class ScheduleClass Schedule Functions:
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Exam ReviewExam Review Arithmetic - I think everyone gets thisArithmetic.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Upcoming Exam – April 8Upcoming Exam – April 8 Structures ReviewStructures.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The examThe exam Hierarchy of FunctionsHierarchy of Functions Solving.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today Cryptography – introductory termsCryptography – introductory terms “Enigma”
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Rest of semesterRest of semester –More on strings (Chapter 10) –More.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class RecapRecap Functions and CFunctions and C Using FunctionsUsing Functions.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class MethodsMethods Problem solving by decompositionProblem solving by.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230 – Today in Class Authorizing OvertimeAuthorizing Overtime Weird Java stuff: conditionals,
March R. Smith - University of St Thomas - Minnesota Today’s Class Lab 1 commentsLab 1 comments Data Types in Chapter 4Data Types in Chapter 4 Lab.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Nested IFNested IF “Boolean” Logical Operations“Boolean” Logical.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Lab Status, Paper StatusLab Status, Paper Status Comments on Ints vs.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Data IndependenceData Independence Matlab #3: Exercise 5.1Matlab #3:
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Buttons: Radio and Check BoxButtons: Radio and Check Box Lab 20Lab.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class StatusStatus –Survey –Returning homework ArraysArrays –What are they?
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Finish up Lab 13Finish up Lab 13 Lab 14 – DetailsLab 14 – Details.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class The examThe exam –Open book, no notes, like last time Exam TopicsExam.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class CachesCaches Direct mapped cacheDirect mapped cache Set associative.
March R. Smith - University of St Thomas - Minnesota ENGR 330: Today’s Class Administrative: do you want another lab?Administrative: do you want.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Revised Lab 14/15Revised Lab 14/15 Counting WordsCounting Words Moving.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Homework & GradesHomework & Grades Multiple DimensionsMultiple Dimensions.
March R. Smith - University of St Thomas - Minnesota Today’s Class Homework NotesHomework Notes –Always try to match the printed output if I give.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Change in order of topicsChange in order of topics –Starting Chapter.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class More LoopsMore Loops Do While – a ‘trailing decision’ loopDo While.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class The ExamThe Exam Homework NotesHomework Notes.
March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class Peek at Lab 16Peek at Lab 16 Side effects and arraysSide effects and.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class AssignmentsAssignments Logical operationsLogical operations Summations.
9/21/2015 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class RecapRecap Files, writing filesFiles, writing files 1D Array Recap1D.
Spring R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Final Exam – rest of class scheduleFinal Exam – rest of class schedule.
March R. Smith - University of St Thomas - Minnesota QMCS 130: Today’s Class Grades & Lab 12Grades & Lab 12 Upcoming ExamUpcoming Exam StructuresStructures.
March R. Smith - University of St Thomas - Minnesota QMCS Class Today “Enigma” recap and finish“Enigma” recap and finish The quiz/surveyThe.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class A note on methodsA note on methods ObjectsObjects Creating your.
1/31/2016 1R. Smith - University of St Thomas - Minnesota CISC Today’s Class RecapRecap Problem 11Problem 11 Problem 12Problem 12.
2/22/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class History Paper scheduleHistory Paper schedule RecapRecap Plus PlusPlus.
March /18R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class What’s on the Exam Next Week?What’s on the Exam Next Week? Lab 8Lab.
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Collect PapersCollect Papers Review: Our ZeroesReview: Our Zeroes Review:
7/6/2016 1R. Smith - University of St Thomas - Minnesota CISC 130: Today’s Class Computer HardwareComputer Hardware Recap: next programRecap: next program.
MSIS 655 Advanced Business Applications Programming
Presentation transcript:

March R. Smith - University of St Thomas - Minnesota QMCS 230: Today in Class More on StringsMore on Strings Strings reviewStrings review Character TestingCharacter Testing Matching/Finding SubstringsMatching/Finding Substrings Building SubstringsBuilding Substrings Modifying StringsModifying Strings Tokenizing StringsTokenizing Strings

March R. Smith - University of St Thomas - Minnesota Strings review Are they primitives or objects?Are they primitives or objects? Find the nth character?Find the nth character? What does str1==str2 mean?What does str1==str2 mean? What about str1.startsWith(str2) ?What about str1.startsWith(str2) ?

March R. Smith - University of St Thomas - Minnesota Character Testing Character.isDigit(ch)Character.isDigit(ch) Character.isLetter(ch)Character.isLetter(ch) Character.isLetterOrDigit(ch)Character.isLetterOrDigit(ch) Character.isLowerCase(ch)Character.isLowerCase(ch) Character.isUpperCase(ch)Character.isUpperCase(ch) Character.isSpaceChar(ch)Character.isSpaceChar(ch) Character.isWhiteSpace(ch)Character.isWhiteSpace(ch) –Means a space, tab, or newline

March R. Smith - University of St Thomas - Minnesota Matching Substrings Str1.startsWith(str2)Str1.startsWith(str2) Str1.endsWith(str2)Str1.endsWith(str2) Str1.regionMatches(o1, “Str2”, o2, len)Str1.regionMatches(o1, “Str2”, o2, len) –O1 = starting point in Str1 –Str2 = string to match with –O2 = starting point in Str2 –Len = length to match

March R. Smith - University of St Thomas - Minnesota Making Substrings Str.substring(i)Str.substring(i) –Returns the part of Str beginning at ‘i’ Str.substring(i,j)Str.substring(i,j) –Returns the part from ‘i’ to ‘j’ –‘j’th character not included What can we use this for?What can we use this for?

March R. Smith - University of St Thomas - Minnesota Modifying Strings –We can’t really – we just make new ones Str1.concat(Str2) – combines themStr1.concat(Str2) – combines them Str1.replace(‘x’, ‘y’)Str1.replace(‘x’, ‘y’) –Replace every ‘x’ with a ‘y’ Str1.trim()Str1.trim() –Removes all leading and trailing white space –A Java lesson – there’s always the ‘right’ method somewhere

March R. Smith - University of St Thomas - Minnesota Tokenizing Strings A way of pulling the pieces out of a stringA way of pulling the pieces out of a string Import java.util.StringTokenizer;Import java.util.StringTokenizer; Constructors:Constructors: –St1 = new StringTokenizer(string); –St2 = new StringTokenizer(string,”-”); –St3 = new StringTokenizer(string,”-”, true);

March R. Smith - University of St Thomas - Minnesota Using the Tokenizer St1.countTokens()St1.countTokens() –Returns number of tokens in the string St1.hasMoreTokens()St1.hasMoreTokens() –Returns ‘true’ if more tokens there Str1.nextToken()Str1.nextToken() –Returns next token as a string

March R. Smith - University of St Thomas - Minnesota Cheap Tokenizing The ‘split’ methodThe ‘split’ method –String tokens[] = Str1.split(“ “); –Returns array of strings delimited by blanks It’s hard to ask for more than blanksIt’s hard to ask for more than blanks –Requires a ‘regular expression’ –Example: looks or.

March R. Smith - University of St Thomas - Minnesota Other things in Chapter 10 Converting strings into char arraysConverting strings into char arrays Numbers to string representationsNumbers to string representations “Boxing” and “Unboxing”“Boxing” and “Unboxing” –Has to do with “object” versions of primitive types –There are ‘wrapper classes’ for primitive types Essentially ‘object’ versions of the typesEssentially ‘object’ versions of the types StringBuilderStringBuilder –A way of making strings you can modify –“Real” strings can’t be modified You can only build new ones based on old onesYou can only build new ones based on old ones

March R. Smith - University of St Thomas - Minnesota That’s it. Questions?Questions? Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.