Skip to content

Instantly share code, notes, and snippets.

@joubertnel
Created December 27, 2022 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joubertnel/74cc3fcc920aa47f0351eeb8cc3fd1c8 to your computer and use it in GitHub Desktop.
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
# 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