How trim?
Jim Ault
JimAultWins at yahoo.com
Mon Oct 24 13:53:41 EDT 2005
Thanks for the input, Wilhelm. You wrote:
<snip>
> It happens very often here that the user inadvertently hits the spacebar
> and creates leading and/or trailing spaces whereas the other portion of
> his input may be correct.
>( simpler scripting loops are good.) At least (they are)
> easier to understand and apply than Regex expressions, especially for
> Xtalk novices.
<snip>
I was thinking about functions that would handle things that were a little
more difficult for repeat loops, such as
-embedded multiple spaces where you are expecting one
-pattern recognition to correct user input, eg
-plurals,
-abbreviations,
-commas vs periods [email and urls ]
-> http://me,com > http://me.com
-"/" vs "\"
Further
Using the Rev 'filter' lines command, as well as matchText, replaceText, etc
<from the docs showing 'with' and 'without' >
filter myVariable with "A?2"
filter me without "*[a-zA-Z]*"
filter field 22 with "[0-9]*"
filter field "Sorted Lines" with "[" & mySelection & "]"
--> and how to filter words and items as well as lines in a container
Any ideas that would help you?
Jim Ault
Las Vegas
On 10/24/05 9:23 AM, "Wilhelm Sanke" <sanke at hrz.uni-kassel.de> wrote:
> On Sun, 23 Oct 2005, Jim Ault <JimAultWins at yahoo.com> wrote:
>
>> snip)
>> Rev is really designed to be a tool box for developers to refine their own
>> solutions and the community shares these results. On one hand, the task
>> might be the occasional string to trim, or on the other, a massive
>> list from
>> a network log file. In your case, you would rather have the flexible
>> version that allowed you to pass the ASII number(s), so you could roll
>> your
>> own with the help of the list.
>>
>> After building what you want, decide if it is to be available every
>> time you
>> run Rev, or only for your intended audience with your app. If only
>> for your
>> app, copy and paste the functions from a place you store them, into
>> the main
>> stack script. Now LTrim(ascii, ascii, ascii) will work every time the way
>> you wish.
>>
>> Read about back scripts, which are available after messages pass the stack
>> level.
>> (snip)
>> Hope this helps you understand a bit more about a development environment
>
>
> I might add one aspect to this discussion, although rather late:
>
> There is one type of applications where you urgently need a trim
> function, namely: educational software that requires text input from the
> learner.
> It happens very often here that the user inadvertently hits the spacebar
> and creates leading and/or trailing spaces whereas the other portion of
> his input may be correct.
> He then gets a "wrong" as a feedback and is very much puzzled about what
> he really did wrong.
>
> One of the first XTalk languages - "HyperPad", the first DOS clone of
> Hypercard about 15 years ago - indeed possessed such a handy function,
> i.e. "trim()" was part of the language.
>
> As in other XTalk languages like Toolbook, Metacard, and eventually
> Revolution such a function was missing, the solution "we" used here
> often was
>
> "repeat until first char of tInput <> space
> delete first char of tInput
> end repeat
> repeat until last char of tInput <> space
> delete last char of tInput
> end repeat"
>
> which scriptwise is rather simple and easy to understand. At least it is
> easier to understand and apply than Regex expressions, especially for
> Xtalk novices.
>
> Regards,
>
> Wilhelm Sanke
> <http://www.sanke.org/MetaMedia>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list