Extract file extension: Difference between revisions

Content added Content deleted
(Added Quackery.)
(→‎{{header|Quackery}}: added code to deal with empty string)
Line 2,072: Line 2,072:
witheach [ bit | ] ] constant
witheach [ bit | ] ] constant
& 0 > ] is validchar ( c --> b )
& 0 > ] is validchar ( c --> b )
[ dup -1 peek char . = iff
[ dup $ "" = if done
dup -1 peek char . = iff
[ drop $ "" ] done
[ drop $ "" ] done
$ "" swap
$ "" swap
Line 2,083: Line 2,084:
else
else
[ 2drop $ "" conclude ] ]
[ 2drop $ "" conclude ] ]
dup 1 split drop
dup $ "" = if done
char . nested != if
dup 0 peek char . != if
[ drop $ "" ] ] is extension ( $ --> $ )
[ drop $ "" ] ] is extension ( $ --> $ )