Find Character after Text ?
#3

PHP код:
#include <a_samp>
main() {
    
GetCharAfter("Hello #25Best""#25"); 
}
GetCharAfter(text[], after[]) {
    new
        
pos strfind(textaftertrue)
    ;
    if(
pos != -1) {
        
printf("Char after find: %c"text[pos strlen(after)]);
    }
    return 
true;

This is your function modified to print the correct result. Notice that I used the %c specifier instead of %s. The string specifier will be replaced by the contents of 'text' after the xth position in the array.

Here's an example of what that means in action:
PHP код:
#include <a_samp>
main() {
    new
        
text[7] = "Hello!"
    
;
    
printf("Everything: %s"text);
    
printf("Only the last 5 characters: %s"text[1]); // This will skip text[0] (start from text[1])
    
printf("Only the last 3 characters: %s"text[3]); // This will skip text[0], text[1] and text[2] (start from text[3])
    
printf("Only the 5th character: %c"text[4]); // This will only print out the character in text[4]

Reply


Messages In This Thread
Find Character after Text ? - by JR_Junior - 20.03.2017, 02:47
Re: Find Character after Text ? - by JR_Junior - 20.03.2017, 03:09
Re: Find Character after Text ? - by AndySedeyn - 20.03.2017, 03:18
Re: Find Character after Text ? - by JR_Junior - 20.03.2017, 07:26

Forum Jump:


Users browsing this thread: 1 Guest(s)