Hi all,
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“)
Any ideas?
All the best,
Malte
Hi all,
thanks for the replies so far.
The problem with both matchChunk and offset are, that they will return the
first occurance of the literal. So in a text like this:
orange banana tomato
banana tomato orange
tomato banana orange
on mouseUp
local temp,tChar
put fld 1 into temp
put
Thanks for all the suggestions. Need some time to try them out. I really like
Thierrys RegEx approach and the others look promissing too.
@Walt: In the real live Scenario I try to colorize Structured Data (e.G. XML,
but others too). I need to walk through the whole dataset token by token and
re
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
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
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
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
s url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
-Original Message-
From: Malte Brill
To: use-livecode
Sent: Thu, Apr 30, 2015 10:03 am
Subject: Something like charIndex, but in a variable...
Hi all,
thanks for
in context:
http://runtime-revolution.278305.n4.nabble.com/Something-like-charIndex-but-in-a-variable-tp4691661p4691679.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-livecode mailing list
use-livecode@lists.runrev.com
> 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
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“)
(
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
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
livecode@lists.runrev.com
> Please visit this url to subscribe,
> unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
>
>
> -Original Message-
> From: Malte Brill
> To: use-livecode
> Sent: Thu, Ap
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
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
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
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,
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
19 matches
Mail list logo