Detect the two first letters from a string?
#1

Hello
I need some help with detect/take out some parts of a string if it is possible.
Example: Lets say that I have a dialog and I type in "Hello". Is it then possible to just get the two first letters from the the inputtext? So my output will be like: "You word Hello starts with He."

Hope you get what I mean
Reply
#2

https://sampwiki.blast.hk/wiki/Strmid

For example:
pawn Код:
strmid(string, "Hello", 0, 2);
That would make "string" be "He".
Reply
#3

Could you show me an example of how to use it with lets say.. Inputtext from one of my dialogs?

Or if anyone else knows a way/example then it would be great
Reply
#4

https://sampwiki.blast.hk/wiki/Firstchars
Reply
#5

new string[128];
strmid(inputtext, string, 2, strlen(inputtext));
Reply
#6

pawn Код:
printf("%c%c",inputtext[0],inputtext[1]);
Reply
#7

Thanks all I will try out the things and see what I can do with it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)