How to start this project...
JimAultWins at yahoo.com
Tue Oct 3 16:29:51 EDT 2006
If you are replacing each char, then you need a repeat loop that calls the
lookup function once for each char.
repeat for each char CH in fld input
put lookupchar(CH) after newString
put newString into fld output
answer "You bidding has been done, Master" & cr & \
fld input & " has been converted to " & cr & \
On 10/3/06 10:51 AM, "Adrian Williams" <adrian at clubtype.co.uk> wrote:
> I decided to start with a simple function,
> before getting involved with what to do with the return value....
> On 2 Oct 2006, at 10:47, Martin Blackman wrote:
>> Jacqueline covered it much better than me there. The lookupchar
>> function was indeed intended as a separate function for you to write.
>> eg. you might do something like this
>> -- field "input" contains list of chars which should be replaced, eg
>> -- field "output" contains your desired output chars in matching
>> order, eg "123"
>> function lookupchar tchar
>> get offset (tchar,field "input")
>> if it = 0 then return tchar else \
>> return char it of field "Output"
>> end lookupchar
> So... I made a new main Stack: lookup.rev,
> created three fields: editedText, input, output,
> and a button to run the script.
> ABC is first line of 'input' field.
> 123 is first line of output filed.
> in field editedText, ABC is entered.
> Button is pressed.
> Result: "Error in handler"
> Hint: function.
> This function should work in its own right - yes?
More information about the Use-livecode