05-23-2011 03:12 PM
I happen to really like the Format Into String function, and have almost forsaken concatenate strings in the case of joining simple strings. One of my favorite features is the automatic generation of the Format String: I can shuffle and add or remove inputs without worrying about changing the Format String. However, is it a bug or feature that LV will add a space between the different inputs, for example:
Three possibilities (at least):
1. Bug : Please fix.
2. Wanted (by most) feature
3. Unwanted (by most) feature
I am sure that someone out there relies on this behavior so it is probably entrenched as a feature by now. In this case I'll probably make a move to suggest an additional input for a default separator. Space by default, but happy with empty string. Either that or a Right-click option to add spaces or not.
Anybody with a reason why the current behavior makes perfect sense?
05-23-2011 03:43 PM - edited 05-23-2011 03:45 PM
I remember a similar discussion from very long ago (pre-NI forum?)
All you need is to actually specify a format, e.g. "%s%s" in this case. The current behavor makes more sense in the case of numbers, e.g. where "1 2" is probably more reasonable than "12" when two consecutive integers are formatted.
05-23-2011 04:07 PM
I was always supprised that the format string is not requires (hiden inside of string format). This leaves ambiguity in the actual format (ie %s %s instead of %s%s)
05-23-2011 04:23 PM
@altenbach wrote:
All you need is to actually specify a format, e.g. "%s%s" in this case.
Of course, but then you have to update it every time you add/remove an input. I hate to specify %s%s%s%s%d%s%s%s%s....
In fact, I typically will wire the inputs and then Edit the format string, but instead of being 90% correct as created, the spaces usually means it is only 10% correct.
05-24-2011 03:29 PM
Darin.K
I looked into this and it is in fact expected behavior, for the reason that altenbach already stated (makes more sense with numbers).
If you are just looking to put strings together, it would probably make more sense to use the Concatenate Strings functions.
Have a great day,
Chris V
05-24-2011 04:08 PM
@Chris V wrote:
Darin.K
I looked into this and it is in fact expected behavior, for the reason that altenbach already stated (makes more sense with numbers).
If you are just looking to put strings together, it would probably make more sense to use the Concatenate Strings functions.
Thanks. I pretty much assumed it was done on purpose, whether or not it makes more sense depends on your usual applications. My usual preference is that if I want something (ie. a space) I'll put it in. Concatenate strings has it use (arrays, for example), but the power of the Format function is the agile handling of multiple types and ease of resizing. If it would just get the format string "right" I wouldn't have to show that little piece of ugliness on the BD. The format function plays so well with the Regex functions, except when I go to piece back the string and I get some added spaces. I'll either stick with my new XNode version which gives me the resizing option as well as separator control, or get around to suggesting that we have that option space/tab/nothing default separator in the native functions.
05-25-2011 02:38 AM
If I had a say in this I would require the format string input as required input instead of adding yet another popup-option to a LabVIEW node.