So I’m using a “Parse Into Array” node that is taking a string stored in a variable with the delimiter being a comma, “,”. My setup works up until the point that I have more than three words in the string being parsed. Is this a bug, or am I just using it incorrectly?
Here is my blueprint (you can see the string contents to the right):
Here is the result:
Now if I add “,Four” to the end of, “One,Two,Three” I get this:
Now it’s telling me I have “6 Words Loaded” (which I’m using for debugging), which is not correct, and it’s giving me a blank string.
Is it possible that it’s adding empty entries?
I know there is a “Cull Array” node, but how exactly do I use it? I can’t seem to find much documentation on it.
Thank you!
Hey there !
On iteration 0
5L Total = 0 (as 5L Total assuming is initialized to Zero, and the index is Zero)
Iteration 1
5L Total = 1 (As the Index is now 1, and 5L Total is still zero)
Iteration 2
5L Total = 3 (As the index is now 2 and 5L Total is 1)
but when you add the 4th Word
Iteration 3
5L Total = 6 (as the index is now 3, and 5L Total is 3 from iteration 2 of the loop)
Hence you are not counting words at all, to do that you would use the “Length” node attached to 5L Total array, coming back from the parse. The blank entries that you are perceiving as “errors”, are attempts I would imagine to access elements outside the array, as this cannot be done, a “null” is being returned, for that get into the print string, and the print string node is saying, “Ok, I was told to print, yet I have a nothing (null) to print, so I will just print nothing”. You can check this, by looking at the output log, when you do a run of the code, to see if there is any message like “Attempted to access 5/4”.
I’m not sure what your trying to accomplish with this logic, but there are simplier ways to do some things.
- To get the count of words parsed, use the “Length” node (mentioned earlier).
- In order to print Access an array N times from an array, just use a For Loop (not For Each Loop), with the number of random accesses you wish to get, as the ending index for the loop.
- This way you will not need 3 print string nodes but one, and have the For Loop do all the work.
Hope this helps,
Inc.
Thanks so much, ! That worked like a charm.