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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1e08410099d337f8,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "R" Newsgroups: comp.lang.ada Subject: creating own Image function Date: 29 Dec 2004 08:51:43 -0800 Organization: http://groups.google.com Message-ID: <1104339103.436794.134250@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 83.238.46.94 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1104339107 13077 127.0.0.1 (29 Dec 2004 16:51:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 29 Dec 2004 16:51:47 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=83.238.46.94; posting-account=vW-V7A0AAADVHjc0FRFWzwhUHLUBcq4I Xref: g2news1.google.com comp.lang.ada:7295 Date: 2004-12-29T08:51:43-08:00 List-Id: Hello. I've written my own Image function it's sth like Java's toString. function Image(this: rec1) return String is tmp : String(1..26); begin tmp := "The value of field is:" & Integer'Image(Get(this)); return tmp; end Image; when I use it: testclass.Create(object, 100); -- note 100 is 3 digits = 3 Characters Put(testclass.Image(object)); then I can see "The value of field is: 100" when I initiate my object with 10 - 2 digits = 2 Characters an exception is raised: CONSTRAINT_ERROR : testclass.adb:34 length check failed it's because tmp: Sting has it's fixed length can it be more flexible? When I tried with String(1..100) the same effect users can initate their objects with 1, 11, 111, 111111 and so on. so my question is: can I write(with Your help of course) a function flexible to handle all those situations? thanks in advnce best regards R