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".
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.
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
Like this?
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!
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
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
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?
@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.