Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
35
Task/Search-a-list/TorqueScript/search-a-list-1.torque
Normal file
35
Task/Search-a-list/TorqueScript/search-a-list-1.torque
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
function findIn(%haystack,%needles)
|
||||
{
|
||||
%hc = getWordCount(%haystack);
|
||||
%nc = getWordCount(%needles);
|
||||
|
||||
for(%i=0;%i<%nc;%i++)
|
||||
{
|
||||
%nword = getWord(%needles,%i);
|
||||
%index[%nword] = -1;
|
||||
}
|
||||
|
||||
for(%i=0;%i<%hc;%i++)
|
||||
{
|
||||
%hword = getWord(%haystack,%i);
|
||||
|
||||
for(%j=0;%j<%nc;%j++)
|
||||
{
|
||||
%nword = getWord(%needles,%j);
|
||||
|
||||
if(%hword $= %nword)
|
||||
{
|
||||
%index[%nword] = %i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(%i=0;%i<%nc;%i++)
|
||||
{
|
||||
%nword = getWord(%needles,%i);
|
||||
%string = %string SPC %nword@"_"@%index[%nword];
|
||||
%string = trim(%string);
|
||||
}
|
||||
|
||||
return %string;
|
||||
}
|
||||
1
Task/Search-a-list/TorqueScript/search-a-list-2.torque
Normal file
1
Task/Search-a-list/TorqueScript/search-a-list-2.torque
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo(findIn("Hello world, you are quite sunny today.","quite hello somethingelse"));
|
||||
1
Task/Search-a-list/TorqueScript/search-a-list-3.torque
Normal file
1
Task/Search-a-list/TorqueScript/search-a-list-3.torque
Normal file
|
|
@ -0,0 +1 @@
|
|||
=> "quite_4 hello_0 somethingelse_-1"
|
||||
Loading…
Add table
Add a link
Reference in a new issue