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