Created
December 27, 2022 15:25
-
-
Save joubertnel/74cc3fcc920aa47f0351eeb8cc3fd1c8 to your computer and use it in GitHub Desktop.
solution to the rmchars string scanning challenge on slide 182 of Unicon Programming Fundamentals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# learning Unicon/Icon. | |
# here's my initial solution to the rmchars string scanning challenge on slide 182 of Unicon Programming Fundamentals | |
# http://www2.cs.uidaho.edu/~jeffery/courses/210/UniconFundamentals.pdf | |
procedure main(args) | |
local t := "For both the structures described." | |
write(rmchars(t, 'sed')) | |
write(t) | |
end | |
procedure rmchars(s, c) | |
local r := "" | |
local char | |
s ? while char := move(1) do r ||:= char -- c | |
return r | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment