Hello! My name is Thomas and I'm a nerd. I like tech and gadgets and speculative fiction, and playing around with programming. It's not my day job, but I'm working on making it a side gig :)
There are filter and keepIf functions defined in the sequtils standard library but that feels like cheating :P
$ is Nim's stringify operator, and the find procedure returns -1 if it doesn't find the substring :)
importstrutils# for the 'find' procedureproc my_filter(start,stop:int):seq[int]=foriinstart..stop:iffind($i,"5")==-1:result.add(i)echomy_filter(1,9).lenechomy_filter(4,17).len
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here's my Nim solution :)
There are
filter
andkeepIf
functions defined in thesequtils
standard library but that feels like cheating :P$ is Nim's stringify operator, and the find procedure returns -1 if it doesn't find the substring :)