60 likes | 148 Views
Session Objectives #U2S11. Key Words. Locate. String. Built-in. MID. Length. LEFT. String Manipulation - Extraction. Most languages have built-in functions to extract part of a string , often being called LEFT, RIGHT or MID LEFT (<string>, <number of characters>)
E N D
Key Words Locate String Built-in MID Length LEFT
String Manipulation - Extraction Most languages have built-in functions to extract part of a string , often being called LEFT, RIGHT or MID LEFT (<string>, <number of characters>) i.E LEFT (“Computing”, 3) returns “Com” but MID (<string>, <starting position>, <number of characters>) i.e(“Computing”, 4, 3) returns “put” TASK: Experiment with the string extract functions using Python and then Javascript. Is the syntax and logic the same?
String Manipulation – Length Again, ,most languages have a function to calculate the number of characters in a particular string, usually: LENGHTH (<string>) i.e LENGTH (<“Computing”>) returns 9 TASK: Try this in Python or Javascript. It is particularly useful validate passwords and increase strengths based on the numbers of characters used. EXT: Design, create and test a program that will encourage strong passwords to be used. What will you have to do first in order to write a suitable software solution?
Password Program Problem analysis: The program MUST • Take user input and store as string • Measure length of string • Make decision based on length whether Strong, Medium or Weak • Output Decision
String Manipulation - Locate Another common in-built function is facilitate the ability to search a string for certain sequences of characters. i.e LOCATE (<search string>, <main string> This varies between languages LOACTE (“put”, “Computing”) would return 4 as it is found from the 4th character along in the string. TASK: Attempt in Python or Javascript and test to see working by getting results of 0 and above. TASK 2: Complete Questions 1-2 in the Activity on p.106 EXT: Create the program in Q3.