Creating fixed field length records

Jim Ault JimAultWins at yahoo.com
Fri Oct 26 14:43:22 EDT 2007


Expanding the previous answers to padding an existing string

-----using Alex Tweedly's format answer--------------------

get "the subject is padding"  --or get space   --or get empty
put 63 into limit 
put char 1 to limit of (it & format("%" & limit & "s", " ")) into myRecord
  
put myRecord & "("&the number of chars in myRecord &")"




---- using the Barncard solution  ----------------------

get "the subject is padding"
put multiChar( it ,space,96) into myRecord
  put myRecord & "("&the number of chars in myRecord &")"


function multiChar pRecord ,pChar,pRecLen
  return char 1 to pRecLen of (pRecord & format("%" & pRecLen & "s", pChar))
end multiChar

Jim Ault
Las Vegas


On 10/26/07 9:14 AM, "Alex Tweedly" <alex at tweedly.net> wrote:

> Len Morgan wrote:
>> While I'm at it, if I DO have to create a string of <record length>
>> first, how do I create a string of spaces <record length> long?
>> 
> put format("%396s", " ") into myRecord
> 
> or
> 
> put format("%" & numSpaces & "s", " ") into myRecord
> 
> 
> 





More information about the use-livecode mailing list