Find words whose first and last three letters are equal: Difference between revisions
Find words whose first and last three letters are equal (view source)
Revision as of 22:39, 22 November 2022
, 1 year agoFutureBasic solution added
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
(FutureBasic solution added) |
||
Line 414:
tartar
testes</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
local fn Words as CFArrayRef
CFURLRef url = fn URLWithString( @"http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" )
CFStringRef string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
CFArrayRef array = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet )
PredicateRef predicate = fn PredicateWithFormat( @"self.length > %d", 5 )
end fn = fn ArrayFilteredArrayUsingPredicate( array, predicate )
void local fn DoIt
CFArrayRef words = fn Words
CFStringRef wd
for wd in words
if ( fn StringIsEqual( left(wd,3), right(wd,3) ) )
print wd
end if
next
end fn
fn DoIt
HandleEvents
</syntaxhighlight>
{{out}}
<pre>
antiperspirant
calendrical
einstein
hotshot
murmur
oshkosh
tartar
testes
</pre>
=={{header|Go}}==
|