From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-06-2018 06:55 AM - edited 09-06-2018 06:58 AM
hi everyone!
i use the format into string function quite a lot,
and sometimes i wish i could get some string input out as uppercase/lowercase.
i have read through the help (the format specifier page too) but couldn't find anything.
so the chance is slim, but maybe there is?
regards & thx for your time!
EDIT: to clarify, i mean the text of an enum, which is converted to string with "%s".
09-06-2018 07:20 AM
I am not aware of anything. Just use the To Uppercase or the To Lowercase function after your Format Into String. This might be a good opportunity for a malleable VI.
09-06-2018 07:46 AM
thx crossrulz
but i see i have miscommunicated my intention/wish,
of course the whole format string is more complicated and the inputs are many,
it would be nice to have a specific portion in uppercase:
e.g. "%s blabla %s blabla %d" and then only the middle %s in uppercase, and the rest as is
09-06-2018 07:52 AM
Like this?
09-06-2018 07:55 AM - edited 09-06-2018 07:56 AM
hi RamonG,
unfortunately this will not work for an enum input 😞
EDIT: i know that i can change before and after, but i wanted the 'format into string' function to do that
but thx for your suggestion anyways!
09-06-2018 08:29 AM
One of the "tricky" parts of Capitalization is whether you want ALL CAPS or what is often called Proper case (where only the first letter of the string is capitalized). OpenG has such a function (they also have CamelCase,WhereEachFirstLetterIsCapitalizedAndSpacesAreRemoved), and it would be easy enough to write one for yourself.
If the Enum you are trying to Format Into String is one you have defined, then just go and capitalize the items as you wish. If, however, it is buried somewhere in VILib or some other Library, you can always format the Enum separately and then change the case of the String. Yes, it is messy, but think of how many "edge cases" you'd need to worry about (see first paragraph). Nothing is Perfect, but LabVIEW's choices are "pretty good" ...
Bob Schor
09-06-2018 08:38 AM
hi bob,
thx for your answer, also not what i was hoping for ...
but i knew it was a long shot.
so i will not mark as solved, but spread a round of kudos.
regards
09-06-2018 12:36 PM
Changing the case of a formatted enum string sounds like a really bad idea. What if the enum contains upper- and lower case versions of the same string as separate items?
What is the purpose of all this? Just cosmetic?
09-06-2018 10:24 PM
@altenbach wrote:
Changing the case of a formatted enum string sounds like a really bad idea. What if the enum contains upper- and lower case versions of the same string as separate items?
Having upper and lower case versions of the same item within an enum sounds like a far worse problem!
@jwscs, I would go with @RamonG's suggestion but use a malleable VI to handle the enum to string to upper case string conversion. I've attached a quick and dirty one but it doesn't do any type or error checking. Note you'll need LV2017+ to use malleable VIs.