String problem

Adam Robertson aroberts@orange.usyd.edu.au
Wed, 16 Jul 2003 12:01:18 +1000


Thanks, that helped me solve it.


Adam Robertson
Acting Database and Web Administrator
University of Sydney, Orange
Phone: 02 6360 5967   Fax: 02 6360 5590
mailto:aroberts@orange.usyd.edu.au



-----Original Message-----
From: powerh-l-admin@cube.swau.edu
[mailto:powerh-l-admin@cube.swau.edu]On Behalf Of Peter Bateman
Sent: Tuesday, 15 July 2003 22:27
To: aroberts@oac.usyd.edu.au; powerh-l@lists.swau.edu
Subject: Re: String problem


Adam:

  You can find the '(' and ')' in unit_name with the index function.

  let t-s = index ( unit_name , '(' )
  let t_unit_name = unit_name [2:size(unit_name)] if t-s = 1 &
                 else  =  unit_name [ 1 : (t-s - 1)] + unit_name[(t-s + 1):(
size( unit_name) - t-s)]
  apply the same logic to t_unit_name to remove ')"

  alternately you can run a for loop on unit_name removing '(' and ')'

  for 255
  begin

     if occurrence <= size ( unit_name) &
      and unit_name [occurrence : 1] <> '(' &
      and unit_name[occurrence:1] <> ')'
      then begin
             let IX = IX + 1
             if IX = 1
               then let t_unit_name = unit_name [occurrence:1]
               else  let t_unit_name = t_unit_name[1:(IX - 1)] + unit_name
[occurrence:1]
  end
Powerhouse unfortunately gives an indexing error if a substring index is out
of range.
The range is 1 to size of string. I would prefer a null string response.
The length can be longer and is a way to pad with blanks.
ie Define s char * 20 = rj ( x [1:20])

Regards,
Peter Bateman



>From: "Adam Robertson" <aroberts@orange.usyd.edu.au>
>To: "Powerhouse List \(E-mail\)" <powerh-l@lists.swau.edu>
>Subject: String problem
>Date: Tue, 15 Jul 2003 16:14:09 +1000
>
>Hi there.
>
>I have a QUICK screen with this code:
>     let t_tempcover = getsystemval("PHTEMP") + "/tempcover.txt"
>     let t_str = "echo '^' >> " + t_tempcover
>     .
>     .
>     let t_cmdstr = substitute(t_str, &
>     ("            " + trunc(unit_name of unit) + &
>      " - " + unit_code of c_assign_student ) )
>     run command t_cmdstr
>
>All has been running fine, except now some of the string data in 'unit_name
>of unit' contains brackets ie    (    and    )
>
>This is causing the screen to crash with this error:    syntax error at
>line
>1: `(' unexpected
>
>If I remove the brackets from the data, it works fine.
>
>Is there any way I can fix this, allowing the brackets to stay in the data.
>Thanks
>Adam Robertson
>Acting Database and Web Administrator
>University of Sydney, Orange
>Phone: 02 6360 5967   Fax: 02 6360 5590
>mailto:aroberts@orange.usyd.edu.au
>

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe <password>" in message body to
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.