CSC104H1 Lecture Notes - Lecture 4: Substring

35 views3 pages
School
Course
Professor

Document Summary

Csc104 computational thinking lecture 4 notes: strings and numbers: if something is not built-in in drracket and is not defined to a particular value, when you input it eg hello there people! Drracket stops at the first thing: string. If you add a quotation to the phrase, drracket see it as a string (one kind of value) Output: (cid:862)hello there people! (cid:863) (cid:894)defi(cid:374)e hey! (cid:862)hello there people! (cid:863)(cid:895) (cid:862)hello there people! (cid:863: (cid:862)(cid:1004)(cid:1005)(cid:1006)(cid:1007)(cid:863) is a stri(cid:374)g, (cid:374)ot a (cid:374)u(cid:373)(cid:271)er, so you (cid:272)a(cid:374) (cid:374)e(cid:448)er do operatio(cid:374)s o(cid:374) it. +: expects a number for the first argument, but received 0123 (string-le(cid:374)gth (cid:862)hello there people! (cid:863)(cid:895) Drracket count how many characters(space including) in the string (excluding quotation marks) If you really want to count in a quotation mark: (string-le(cid:374)gth (cid:862)(cid:1004)(cid:1005)(cid:1006)(cid:1007)\(cid:863)(cid:1008)(cid:1009)(cid:863)(cid:895) So the length of this string is 7: you now want only part of the string. Substring: expects three argument, but only found only one.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions