Page 1 of 1

Last but one

Posted: Mon Sep 02, 2019 1:42 pm
by richmond62
So, here I am trying to analyse a whopping-great text for words with certain
suffixes (= bits that go on the end of words) . . .

Now, it is dead easy to analyse texts for prefixes (= bits that go on the front of words)
using a series of nested loops for char 1, char, char 3 and so on . . .

Now I can ask questions about the last char of a word . . .

But, short of popping that word into a variable and nipping characters of the end
sequentially it seems "a bit of a pain" as I cannot do this sort of thing . . .

pseudoCode

last char
(last -1) char
(last -2) char

nicht?

Re: Last but one

Posted: Mon Sep 02, 2019 1:49 pm
by Klaus
Maybe you mean:
char -1 of xxx ## = last char
char -2 of xxx ## = last but one char
char -3 of xxx ## = you guess...
?

Re: Last but one

Posted: Mon Sep 02, 2019 1:51 pm
by richmond62
Wow, Klaus, you're the man! :D

Re: Last but one

Posted: Mon Sep 02, 2019 2:18 pm
by bogs
Or if you combined those and cut out the middle, (if your talking about *just* the last 3 characters) why not

char -3 to -1 of xxx ## = last 3 chars

Code: Select all

put "working" into tmpWord; put char -3 to -1 of tmpWord
= "ing"

Re: Last but one

Posted: Mon Sep 02, 2019 7:05 pm
by richmond62
Wow: I could get completely "bogged" down. :D

Re: Last but one

Posted: Mon Sep 02, 2019 7:10 pm
by bogs
I know I do :D