String question
#1

Say a string contains a integer inside it, example:

pawn Код:
new string[12], number;
number = 7;
format(string, sizeof(string), "%i", number);
Can I somehow take the integer inside the string and use it? Because everytime I try plugging in the string, it gives me a warning:

pawn Код:
warning 213: tag mismatch
Help would be greatly appreciated, thanks for your time.
Reply
#2

removed
Reply
#3

Argh, please read the original thread, I know how send a string. Maybe I wasn't clear, I want to put a integer into a string, and then use that string to transfer the integer into a function. So how can I take the original integer out of the string and make it fit into a integer function.
Reply
#4

You've confused me.

If you want to take an integer out of a string, you can use strval to extract the integer. It only works if it's just an integer in the string, nothing else.

Also, you can use valstr to do the contrary - which would be to convert an integer into a string.

Which line do you get an error on by the way?
Reply
#5

Quote:
Originally Posted by Calgon
Посмотреть сообщение
It only works if it's just an integer in the string, nothing else.
AFAIK it works if there's text too, but after the integer. So "69 is my favourite number" should return 69.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)