How to check if a character is last in line?
#1

As topic says..

How to check if a character is last in line
I made this code.. and it works, but for string it doesn't matter is it in the center of the line or on the first character in the line.. i know how strfind works but don't know how to check is character is in the last place in the line.

pawn Код:
if(strfind(text, "?", true) != -1)
P.S
Please, reply this time
Reply
#2

If by line you mean text variable, then
pawn Код:
if(strfind(text, "?", true) == (strlen(text)-1)) print("Hey, I'm last!")
Reply
#3

or just

pawn Код:
if(text[strlen(text) - 1] == '?') {}
Reply
#4

Yup, just wanted suggest that. Only one function used
Reply
#5

Yep, thanks guys for the help. Works great!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)