If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
String array bug
3 posts
• Page 1 of 1
String array bug
While working on string conversions, I stumbled upon this pesky little annoyance. Using the text box or string box to generate a string array, every char is recognized but not the comma! Only by building a string array via the string array prim, the comma is recognized.
Here is a schematic, which should make the issue obvious.
Here is a schematic, which should make the issue obvious.
- Attachments
-
- String_Bug.fsm
- Example of the comma not being recognized by string-to-string-array conversions.
- (1.28 KiB) Downloaded 725 times
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: String array bug
I think the problem is how text to string array conversion is handled. Basically, text primitive outputs a string. To convert it to string array, some delimiter is required. "," comma and "\n\r" newline characters are two separators (note that whitespace after and before the comma/newline is also ignored).
In your example, the first method (text prim connected to string array connector) comma is considered a delimiter of two empty strings. You can observe this behaviour is true, by creating a ruby component with string array input and then "watch" the input - you will see an array of two empty strings.
In the third example (the one that works) "," string is specifically added to the previously empty string array. If you connect the output of that prim to previously mentioned ruby component, you can clearly see this.
conclusion: Via text prim connected to a string array connector you cannot create an array of strings, which would contain comma or newline. To create such a string you either need to use string array prim, array builder prim or Ruby.
In your example, the first method (text prim connected to string array connector) comma is considered a delimiter of two empty strings. You can observe this behaviour is true, by creating a ruby component with string array input and then "watch" the input - you will see an array of two empty strings.
In the third example (the one that works) "," string is specifically added to the previously empty string array. If you connect the output of that prim to previously mentioned ruby component, you can clearly see this.
conclusion: Via text prim connected to a string array connector you cannot create an array of strings, which would contain comma or newline. To create such a string you either need to use string array prim, array builder prim or Ruby.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: String array bug
Yes, KG, that's exactly why I call it a bug.
There is absolutely no reason to make a comma a seperator to split strings. It just doesn't make sense. A comma is an integral part of text, in any language. Control signs are the only seperators that make sense (newline, carriage return, tabulator, etc.)
For me it is either lazyness or inattention. The comma obviously is a relic from the text to float array conversion. But since the conversion type is known, it would have been not much more than branching a line of source code or two.
There is absolutely no reason to make a comma a seperator to split strings. It just doesn't make sense. A comma is an integral part of text, in any language. Control signs are the only seperators that make sense (newline, carriage return, tabulator, etc.)
For me it is either lazyness or inattention. The comma obviously is a relic from the text to float array conversion. But since the conversion type is known, it would have been not much more than branching a line of source code or two.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 52 guests