bondol_hendra
11th July 2019, 06:57
Hello,

I need to get last characters.
example :
1. "ASSDEFTR"
2. "QWEETYOORE"
3. "RSTUDS"

I need value :
1. "FTR"
2. "ORE"
3. "UDS"

If i using STRING(6,3),
number 1 is not problem. but if number 2 I can get value "YOO" not "ORE"

how to get last character?
sorry if my question not good.
thanks.

bhushanchanda
11th July 2019, 07:43
Hi,


Use len() function to calculate total length and then taken last 3 using something like this -



long ls

string seqstr(100)

seqstr = "LONDON"

ls = len(seqstr)

seqstr = seqstr(ls-2;3) | seqstr now stores the last 3 characters of the string which is "DON"

bondol_hendra
11th July 2019, 11:00
Hi,


Use len() function to calculate total length and then taken last 3 using something like this -



long ls
string seqstr(100)


seqstr = "LONDON"
ls = len(seqstr)
seqstr = seqstr(ns-2;3) | seqstr now stores the last 3 characters of the string which is "DON"


thanks. i will try it.
but "seqstr(ns-2;3)" this is "ns" or "ls"?
i am make sure it.

bhushanchanda
11th July 2019, 12:16
Yup. Sorry for the typo. Corrected.

OmeLuuk
11th July 2019, 12:53
And to be sure you do not end up with spaces in a fixed string, you can use
seqstr = seqstr(len(strip$(seqstr))-2;3)

srkndnsn
7th January 2021, 10:51
And to be sure you do not end up with spaces in a fixed string, you can use
seqstr = seqstr(len(strip$(seqstr))-2;3)

It works very well, thank you