LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Into String problem

Does anybody known how to remove the space that the 'Fomat Into String'
vi adds at the end of the output string? We're crearing filenames that
cannot contain spaces.
0 Kudos
Message 1 of 6
(3,419 Views)
Michel Grenier schrieb in im Newsbeitrag:
38622BED.CDCB5BDB@NRC.ca...
> Does anybody known how to remove the space that the 'Fomat Into String'
> vi adds at the end of the output string? We're crearing filenames that
> cannot contain spaces.
>
>

maybe your format string contains a space character

robert
0 Kudos
Message 2 of 6
(3,419 Views)
In article <38622BED.CDCB5BDB@NRC.ca>,
Michel Grenier wrote:
> Does anybody known how to remove the space that the 'Fomat Into
String'
> vi adds at the end of the output string? We're crearing filenames that
> cannot contain spaces.
>
>
If there are a known number of spaces and they are always in the same
spot (i.e. 1 space at the end of the string, all you should have to do
is do a LEN on the string, and then use (LEN-1) as the Length input of
the String Subset Function. If there are many spaces, you can use a
"space" as the search character input to a Split string function and
then use concatenate of the Substring before the Char output string to
the Character output string Trimmed by the space. The easiest thing to
do for this is to
create a VI Called something like Strip_Spaces.vi so
you couyld use it anywhere.
GL


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 3 of 6
(3,419 Views)
I use LV version 5.0.1 so this may be slightly different than what your are
doing.

Right click on the 'Format Into String.vi' and select 'Edit Format String'

In the 'Corresponding Format String' field in the dialog box that appears,
you should see one format character (%f = fractional %s=string, etc.) for
each input to be converted to a string. Remove any spaces that occur in
this field that you do not want and and click on 'Create String.'

The string constant that is created is attached to the 'Format String'
input of the 'Format Into String.vi'

Pat

Michel Grenier wrote:

> Does anybody known how to remove the space that the 'Fomat Into String'
> vi adds at the end of the output string? We're crearing filenames that
> cannot contain spaces.
0 Kudos
Message 4 of 6
(3,419 Views)
Another alternative may be to find the string length n, and then take a subset
of length n-1 of that string, which will be the filename without spaces.

Michel Grenier wrote:>>> Does anybody known how to remove the space that
the 'Fomat Into String'>> vi adds at the end of the output string? We're
crearing filenames that>> cannot contain spaces.>
0 Kudos
Message 5 of 6
(3,419 Views)
Thank you for the accurate and succinct response to this question. It was a great help solving the issue of extra spaces in the resulting string.
0 Kudos
Message 6 of 6
(3,419 Views)