Re: SDL-News: Operations on Character strings.

Subject: Re: SDL-News: Operations on Character strings.
From: Rick Reed TSE (
Date: Thu Jan 01 2004 - 17:34:18 GMT

Become an SDL Forum Society member <>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <> to sdlnews ----- at wrote on 01/01/04 16:00:

> Hello all
> A happy new year to start with and I hope that Christmas hasn't left you
> feeling too full.
> According to Z100 and to Doldi's book. There are operations of 'Last' and
> 'First' that can be carried on Strings and as CharStrings inherit from
> strings, on Charstrings. I cannot work how to write an assignment though.
> With x and y declared as Charstrings, x being a string of two characters each
> declared as Charstrings and y Charstring variable
> I would like to be able to use y := First(x) to get the value of y as the
> first character in x. But when I write that is a task box I get the error
> message No unique expression matches left side of assignment. I understand
> what that means but how do I assign y to the first character in the string?
> Please
> Regards Keith Moss

Dear Keith,

The result of first(s) and last(s) where s is a String with element items of
type X is an a value of type X. Hence, for a Charstring the result is a
Character. Therefore if you want to store this value in a Charstring you
have to do a type conversion to a string value by applying mkstring or Make.

For example,

   y:= mkstring(first(x));
   y:= Make(first(x)); /* defined to be same as mkstring for String types */
   y:= (. first(x) .); /*shorthand for Make*/

Note: the literal notation for single Character values is the same as the
notation for a Charstring of length 1. For example,

   DCL c Character;
   DCL cs Charstring;

   c := 'K'; /* Character K */
   cs := 'K'; /* String of one Character K */

Rick Reed -
Tel:+44 15394 88462 Mob.:+44 7970 50 96 50

--End text from Rick Reed TSE <> to sdlnews --- For extra SDL Forum Society benefits join at <>

This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:50 GMT