If the example you give is an accurate portrayal of what you are trying to do,
why not just:
set the backcolor of char 1 of word 2 of line 3 of temp to "red"??
-- Peter
Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig
On Apr 30, 2015, at 10:02 AM, Malte Brill wrote:
> Hi
You're right Ben - your general approach can be combined with my (simple
minded) approach, and a few simple checks thrown in to give us a general
function (reasonably, but not comprehensively, tested - up to things
like "token 3 of word 2 to 4 of line 3 to 7" ...)
on mouseup
local myChunk,
Hi Alex,
Yes that's that approach I was trying to make a relatively general version of
(see my response 16:50) to handle arbitrarily complex chunk expressions - but
it would still fail (in fact probably worse?) with chunk 1. But I think the
principle is right.
Ben
On 30/04/2015 23:26, Alex
Not quite so straightforward, but you can do
function getCharIndexByLineToken pVar, pLine, pToken
local temp
put the number of chars in line 1 to (pLine-1) of pVar into temp
add 1 to temp -- for the CR between lines 14 and 15 !!
add the number of chars in token 1 to (pToken-1) of line
Sorry to be so dense but can you colorize text without a field? Or are you
running through the text as an XML tree (either Rev's or your own) or
manually editing HTML text behind the scenes and adding a colorization
attribute?
On Thu, Apr 30, 2015 at 4:32 PM, Malte Brill wrote:
> Thanks for all
I'm not sure I get it Malte. If you already know which line your target is
on, then just limit the chunk expression to that line.
On Thu, Apr 30, 2015 at 10:51 AM, wrote:
> Malte.
>
>
> Just so. Too fast on keyboard, too slow in brain. How about this:
>
>
>
> on mouseUp
>put fld 1 into temp
For those whose eyes glaze over when looking at regexp, it seems Jacque's
suggestion of the offset function making use of the chars to skip easily
solves this problem. I don;t have the original post in front of me so
can't remember if the objective was to find the last occurrence of the
character
Here's a function I use all the time, which may come in handy:
function offsets str, pContainer
-- returns a comma-delimited list of all the offsets of str in pContainer
-- returns 0 if not found
-- note: offsets("xx","xx") returns "1,3,5" not "1,2,3,4,5"
-- ie, overlapping of
On 30/04/2015 09:07, Malte Brill wrote:
I need to find the start and end character of chuncks in a variable. If we are
in a field we can use charIndex for that. However, in a variable I have no good
idea on how to do something similar to
get charIndex(token 7 of line 15 of field „myField“)
(
> orange banana tomato
> banana tomato orange
> tomato banana orange
Experimenting with regex...
Sorry, couldn't resist :)
function MalteCharIndex T, nWord, nLine,@p1, @p2
get format( "(?mx)(?: .*? \\n){%d} (?: (\\w+) [\\W]*){%d}", nLine
-1, nWord)
return matchChunk( T, IT, p1, p2)
end
Just so. Too fast on keyboard, too slow in brain. How about this:
on mouseUp
put fld 1 into temp
get the number of chars of word 1 to 8 of temp -- first char
answer it & "," & the number of chars of word 8 of temp + it
end mouseUp
Craig
--
View this message in context:
http:
Malte.
Just so. Too fast on keyboard, too slow in brain. How about this:
on mouseUp
put fld 1 into temp
get the number of chars of word 1 to 8 of temp -- first char
answer it & "," & the number of chars of word 8 of temp + it
end mouseUp
Craig
Will hilite the first b instead of t
Will the offset function work?
put the number of chars in line 1 to 14 of tVar into tCount
put offset(startChar, line 15 of tVar) + tCount into tStart
put offset(endChar, line 15 of tVar) + tCount into tEnd
On April 30, 2015 3:07:05 AM CDT, Malte Brill wrote:
>Hi all,
>
>I need to find the s
Schonewille
To: How to use LiveCode
Sent: Thu, Apr 30, 2015 8:00 am
Subject: Re: Something like charIndex, but in a variable...
Hi Malte,
If using a field is the only solution, try the
templateField.
--
Kind regards,
Mark
Schonewille
Economy-x-Talk
Http://economy-x-talk.com
Share the
Hi Malte,
If using a field is the only solution, try the templateField.
--
Kind regards,
Mark Schonewille
Economy-x-Talk
Http://economy-x-talk.com
Share the clipboard of your computer over a local network with Clipboard Link
http://clipboardlink.economy-x-talk.com
Op 30 apr. 2015 om 10:07 he
Best I could do is:
*on* mouseUp
*local* tVar, tStart, tEnd
*put* fld "fData" into tVar
*get* matchChunk(tVar, "(" & word 8 of tVar & ")", tStart, tEnd)
*answer* tStart & comma && tEnd
*end* mouseUp
On Thu, Apr 30, 2015 at 4:07 AM, Malte Brill wrote:
> Hi all,
>
> I need to find the start
16 matches
Mail list logo