PDA

View Full Version : Returning an integer from a string?



KeepBotting
06-26-2014, 12:18 AM
Let's say I had a function that returns a string, how would I go about returning the integers (if any) from said string?

Ian
06-26-2014, 12:20 AM
Let's say I had a function that returns a string, how would I go about returning the integers (if any) from said string?

So taking '5tr1n9' and getting '519'?

KeepBotting
06-26-2014, 12:24 AM
So taking '5tr1n9' and getting '519'?
Yes exactly

The Mayor
06-26-2014, 01:02 AM
Yes exactly

just use extractFromStr using numbers


extractFromStr(string, numbers);


e.g:


program new;

const
string1 = 'h3ll0';

begin
writeLn(extractFromStr(string1, numbers));
end.

KeepBotting
06-26-2014, 01:17 AM
just use extractFromStr using numbers


extractFromStr(string, numbers);


e.g:


program new;

const
string1 = 'h3ll0';

begin
writeLn(extractFromStr(string1, numbers));
end.


Okay awesome thanks

Now I just need a way to return all the text on the last line of the chatbox, any idea how to do that? chatbox.findAnyText() allows you to set your own text to search for, and I don't want that. I just want to return the whole line.

Ian
06-26-2014, 01:43 AM
Okay awesome thanks

Now I just need a way to return all the text on the last line of the chatbox, any idea how to do that? chatbox.findAnyText() allows you to set your own text to search for, and I don't want that. I just want to return the whole line.

You can use tesseractGetText.

For an example of how to use it see chatbox.getXP by Ashaman88: https://villavu.com/forum/showthread.php?t=107292

KeepBotting
06-26-2014, 02:17 AM
You can use tesseractGetText.

For an example of how to use it see chatbox.getXP by Ashaman88: https://villavu.com/forum/showthread.php?t=107292
Perfect that's exactly what I needed

Thanks all