What would be the easiest way to get the character positions of a word in a field?
ie (pseudo code)
get beginning and/or end character postion of word x in field "My Text"
Thanks for any help!
Warren
Character Position Of Word in Field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Character Position Of Word in Field
Hi,
You can try this script.
startEndWord return the position of the fist char and the position of the last char of the word
Best
Jean-Marc
You can try this script.
startEndWord return the position of the fist char and the position of the last char of the word
Code: Select all
on mouseUp
put startEndWordInFld(TheWord,fld 1)
end mouseUp
function startEndWordInFld pWord,pText
put empty into rStartEndWordInFld
put the num of chars of pWord into nbc
put offset(pWord,pText) into startW
put startW+nbc-1 into endW
put "char"&&startW&&"to"&&endW into rStartEndWordInFld
return rStartEndWordInFld
end startEndWordInFld
Jean-Marc
https://alternatic.ch