LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
altenbach

Fixed length string datatype

Status: New

This has been brought up long ago, but I thing it deseves to be discussed here in the Idea exchange.

 

There are situations where it might be beneficial if we could have a string datatype that has a defined length. Arrays of such string would be stored flat in memory.

 

Application would include:

  • Typecasting a long string to a string array where the element is fixed length would slice up the string into an array of equal length strings.
  • Reading a binary file as an array of fixed strings would do the same.
  • ...

 

The default value would be a string of the defined lenght filled with \00. Shorter inputs would get padded with \00

Of course certain operations would drop the length, e.g. when concatenating such strings, the length would get dropped from the result, turning it into a plain string.

2 Comments
CBlum
Member

Yes a defined length for string would be very nice.

 

But i think to defined which character are allowed to insert the string would be good too (alphabetic, numbers,... ).

Michael_78
Active Participant
Fixed length string would be beneficial on RT to improve performance, and there would be no reason why fixed length strings could not then be implemented on FPGA. Another use case could be an ' output window ' where text could be continually be written to a string indicator of fixed size without the programmer having to continually shorten the string. This would also improve performance as the memory manager would not be called for each write.