I work with strings in pseudo C ++ scripts, Unrealscript, and faced with the fact that you need to identify duplicate rows in the array, that is, a string with the same content but under a different index, you need to somehow define it.
An array looks like this:
array<string> strArr;
it already has lines in advance, something like this
strArr = {"Temporarily","Increases","Momentarily", "Chance","Increases","Temporarily","Momentarily"};`
If you iterate each word through a for loop
for(i = 0; i < 100;i++) { debugf("string %s"strArr[i]); }
How then to compare the read lines, on the duplicate - with those that go in the queue?
Create a duplicate array, and add another 1 loop inside the main one? Ie like this
for(i=0;i<strArr.length;i++) { strArr[i]; for(k=0;k<strArrDub.length;k++) { if(strArr[i]==strArrDub[k]) } }
And it turns out that if, for example, the main loop [i] stopped at the 7th element Momentarily
, then the second cycle [k] will go through everything from 0 to the first occurrence of 'Momentarily', which will already be under index 3, and then the test will work, is not it ?
if yes then, is it possible to somehow present it differently or speed it up, there is a pseudo hashmap in Unrealscript, and some functions of the arrays do not work very well.
uniq
algorithm. At least in your version of two cycles, I would use the same array - why the second one? - and the second cycle would start withk=i+1
. - Harry