Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Behavior of "intOf" on a string
Topic Summary:
Created On: 5-Sep-2007 19:29
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 5-Sep-2007 19:29
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

Does anyone understand the behavior of the intOf function?

I wrote a sample script that is attached.

    The script captures today's date and stores it in a variable.

    Today's day value is parsed out and stored in another variable.

    The day value is printed out correctly.

    When the I attempt to store the day value as an int I receive a different value


Is this a known bug, or do I not understand how the intOf function behaves.

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 5-Sep-2007 19:58
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

With me searching the forums a little bit more here I figured by using

int fooInt = intOf(realOf(day))

seems to resolve my problem.

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 6-Sep-2007 07:20
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Pete,

in Doors 8.1 your example code works fine and gives correct result.
BTW: intOf (foo) gives correct result too

Take care with parsing date strings. Starting with Doors 8, there are locales which will change the behaviour of date to string conversion.

Would suggest to use (for Doors 8 or higher):
string foo = stringOf (d, "d");
instead, to be sure to have the day only.

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 6-Sep-2007 13:17
User is offline View Users Profile Print this message


Pete Kowalski

Posts: 301
Joined: 7-Feb-2003

Thanks Reik for the information.

I ran my code in DOORS 7.1, which is used in production here. I have access to both DOORS 8.1 and 8.2 so I will do some experiements with those versions as well.

-------------------------
pete.kowalski(at)motorola.com
Report this to a Moderator Report this to a Moderator
 6-Sep-2007 23:44
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

That code seems to work for me also. I notice that the day digits are zero padded, that is today is "06 September 2007". I adjusted it a little; you want only the first 2 characters of the date foo[0:1], not the first 3 foo[0:2] which includes the trailing space.

The code works in v7.1 and v8.1.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.