Text between: Difference between revisions

Added Quackery.
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(Added Quackery.)
Line 2,510:
print textBetween( thisText, startString, endString )
</syntaxhighlight>
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="Quackery"> [ dup $ "start" = iff
drop done
tuck over findseq
tuck over found iff
[ unrot dip size +
split nip ]
done
2drop drop $ "" ] is from-start ( $ $ --> $ )
 
[ dup $ "end" = iff drop done
over findseq split drop ] is to-end ( $ $ --> $ )
 
[ dip from-start to-end ] is between ( $ $ $ --> $ )
 
[ char " tuck join join
echo$ cr ] is quote$ ( $ --> )
 
[ 3 pack dup
dip unpack unpack
rot say " Text: " quote$
swap say " Start: " quote$
say " End: " quote$
between
say "Result: " quote$
cr ] is task ( $ $ $ --> $ )
 
$ "Hello Rosetta Code world" $ "Hello " $ " world" task
$ "Hello Rosetta Code world" $ "start" $ " world" task
$ "Hello Rosetta Code world" $ "Hello " $ "end" task
$ "Hello Rosetta Code world" $ "Hello " $ "end" task
$ '</div><div style=\"chinese\">???</div>'
$ '<div style=\"chinese\">' $ "</div>" task
$ '<text>Hello <span>Rosetta Code</span> world</text><table style=\"myTable\">'
$ "<text>" $ "<table>" task
$ '<table style=\"myTable\"><tr><td>hello world</td></tr></table>'
$ "<table>" $ "</table>" task
$ "The quick brown fox jumps over the lazy other fox"
$ "quick" $ "fox" task
$ "One fish two fish red fish blue fish"
$ "fish " $ " red" task
$ "FooBarBazFooBuxQuux" $ "Foo" $ "Foo" task</syntaxhighlight>
 
{{out}}
 
<pre> Text: "Hello Rosetta Code world"
Start: "Hello "
End: " world"
Result: "Rosetta Code"
 
Text: "Hello Rosetta Code world"
Start: "start"
End: " world"
Result: "Hello Rosetta Code"
 
Text: "Hello Rosetta Code world"
Start: "Hello "
End: "end"
Result: "Rosetta Code world"
 
Text: "Hello Rosetta Code world"
Start: "Hello "
End: "end"
Result: "Rosetta Code world"
 
Text: "</div><div style=\"chinese\">???</div>"
Start: "<div style=\"chinese\">"
End: "</div>"
Result: "???"
 
Text: "<text>Hello <span>Rosetta Code</span> world</text><table style=\"myTable\">"
Start: "<text>"
End: "<table>"
Result: "Hello <span>Rosetta Code</span> world</text><table style=\"myTable\">"
 
Text: "<table style=\"myTable\"><tr><td>hello world</td></tr></table>"
Start: "<table>"
End: "</table>"
Result: ""
 
Text: "The quick brown fox jumps over the lazy other fox"
Start: "quick"
End: "fox"
Result: " brown "
 
Text: "One fish two fish red fish blue fish"
Start: "fish "
End: " red"
Result: "two fish"
 
Text: "FooBarBazFooBuxQuux"
Start: "Foo"
End: "Foo"
Result: "BarBaz"</pre>
 
=={{header|Racket}}==
1,462

edits