Setting string attribute to blank(s)

In the DOORS User Interface you can set a string attribute to contain only blanks.

However if you try to do the same thing with DXL it only results in an empty string.
Example: 

obj."Object Short Text" = "   "

This strangely results in the attribute value "" (i.e. the empty string)
It seems it is not possible to set an string attribute to one or more blanks. 

Moreover, if there is a default value defined for the attribute the code line above will trigger that default. That is most probably not what you want if you try to put in on ore more blanks.


Is this a known behaviour (sorry if question has been asked before, didn't mananage to find it)?
Any known reason?
Any ideas for a work-around?

 

PS. One may ask why you would want to set an attribute to one or more blanks?

Say you want to mirror an attribute. If a user has put in blanks in the original attribute you would like to mirror that exacltly.


morast - Fri Dec 18 03:43:19 EST 2015

Re: Setting string attribute to blank(s)
Mathias Mamsch - Fri Dec 18 07:15:14 EST 2015

Hmm ... Never noticed this, but you are right. Only workaround I have found from quickly looking at it, is to put a non breakable space (char 160) inside the string, to make DOORS keep it.

(current Object)."Object Short Text" = "          ";

print "#" (current Object)."Object Short Text" "#"; // prints ##

(current Object)."Object Short Text" = (charOf 160) "         ";

print "#" (current Object)."Object Short Text" "#"; // prints #      #

So you could make a regexp that matches on strings that consist of entire whitespace, and replace the first space by chr(160).

Maybe that helps, regards, Mathias

Re: Setting string attribute to blank(s)
morast - Fri Dec 18 09:05:27 EST 2015

Mathias Mamsch - Fri Dec 18 07:15:14 EST 2015

Hmm ... Never noticed this, but you are right. Only workaround I have found from quickly looking at it, is to put a non breakable space (char 160) inside the string, to make DOORS keep it.

(current Object)."Object Short Text" = "          ";

print "#" (current Object)."Object Short Text" "#"; // prints ##

(current Object)."Object Short Text" = (charOf 160) "         ";

print "#" (current Object)."Object Short Text" "#"; // prints #      #

So you could make a regexp that matches on strings that consist of entire whitespace, and replace the first space by chr(160).

Maybe that helps, regards, Mathias

Thanks!

Yes I guess the proposed work-around using non breakable space as replacement is the best one can hope for :-(