From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7c79b932e1a23ed9 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Type casting question Date: 1999/12/21 Message-ID: <83o4bu$iot$1@hobbes2.crc.com>#1/1 X-Deja-AN: 563435634 References: <385E87D8.2B44B800@tridsys.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@crc.com X-Trace: hobbes2.crc.com 945788094 19229 198.175.145.56 (21 Dec 1999 14:54:54 GMT) Organization: CRC: A wholly owned subsidiary of Thermo Electron NNTP-Posting-Date: 21 Dec 1999 14:54:54 GMT Newsgroups: comp.lang.ada Date: 1999-12-21T14:54:54+00:00 List-Id: Raju Vemulamanda wrote in message news:385E87D8.2B44B800@tridsys.com... > Question: Could someone please provide some solution > to the below? > > I have this question in the conversion of values > between the string and the my own type shown below. > > type Bit_5 is range 2#0# .. 2#11111#; > for Bit_5'Size use 5; > subtype Size_Type is Bit_5; > > The above is how Size_Type has been declared. > > val1 : Jvmfr3_Field_Types.Size_Type := 10; > > Suppose I have a string xxx which has the some value in it, > How can I convert that xxx into the above declared val1? > I have to copy xxx into val1. I need to somehow do the > type casting for the above. Any valid string representation of a scalar value can be converted to the corresponding value by using the 'Value attribute of the type. So.... for your type Bit_5, if you have the declaration: A_Bit_5_Value : Bit_5; Then you can say A_Bit_5_Value := Bit_5'Value ("2#10101#");