Jump to content


- - - - -

Format String into Variant suggestions


4 replies to this topic

#1 candidus

    Very Active

  • Members
  • PipPipPip
  • 54 posts

Posted 15 February 2012 - 10:38 PM

I'm currently writing an XML library based on OpenG Data and String functions. I use the functions Format Variant into String and Scan Variant from String to do String<->Variant conversions. It works but I stumbled upon problems that required me to modify these VIs:

- Scan Variant from String can change the data type of the original Variant. If I format any integer type the output Variant alway contains an I64, any floating point type becomes an EXT, any complex type becomes a CXT. This was not acceptable for me so I fixed it

- Both VIs have problems with locale decimal points if no format string is specified. I added a control Default Floating Point Format to specify a default format string for floating point numbers.

Attached File  StringToVariant.zip (78.14K)
Number of downloads: 26

I'd like to contribute my modifications, IMHO they could be useful for others, too. :)

#2 Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 673 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 15 February 2012 - 10:52 PM

There is an active review of the variant tools in this thread

http://lavag.org/top...uration-update/

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#3 candidus

    Very Active

  • Members
  • PipPipPip
  • 54 posts

Posted 19 February 2012 - 08:27 AM

Thank you, but these VIs aren't part of the Variant package. They are part of the string package and I didn't want to hijack a possibly unrelated thread...

But I have to admit, I often look for them in the Variant palette, miss them and then remember the string palette :)

#4 Phillip Brooks

    The 500 club

  • Members
  • PipPipPipPipPip
  • 673 posts
  • Location:Boston, MA
  • Version:LabVIEW 8.6
  • Since:1999

Posted 21 February 2012 - 12:23 PM

View Postcandidus, on 15 February 2012 - 10:38 PM, said:

Both VIs have problems with locale decimal points if no format string is specified. I added a control Default Floating Point Format to specify a default format string for floating point numbers.


I don't use either library often, what caught my eye was the locale decimal point part. The addition of a specifier for the separator and the implications are being discussed in the other thread.

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T


#5 candidus

    Very Active

  • Members
  • PipPipPip
  • 54 posts

Posted 01 March 2012 - 04:11 PM

Hmm, no discussion...

What's wrong? This is the right place to post OpenG suggestions, isn't it?