pawn check if string contains
Hello guys how i can check if string contains symbols
for example if(playerName.Contains("<") || playerName.Contains("-")){ } or how i can check string with regex pattern Thanks |
Re: pawn check if string contains
Code:
Here is how you would check against a pattern: Code:
If you are going to use the same pattern more than once, it would be best to compile it. See regex.inc for more information. |
Re: pawn check if string contains
Hello,
How to make it work with double quotes? " It won't work both of them. Code:
new FirstArg[ 32 ], SecondArg[ 32 ]; |
Re: pawn check if string contains
I don't know reg-ex, but this will cover checking that the second arg is wrapped in quotes.
Code:
register_concmd( "amx_test" , "Test" ); |
Re: pawn check if string contains
Quote:
Works like a charm, very good thanks a lot @Bugsy |
Re: pawn check if string contains
With my method it will need coding to handle every single scenario. So the above could be named VerifyArg3HasQuotes(), then another can be created for Arg1HasQuotesArg2IsNumberArg3HasQuotes() and so on.
|
Re: pawn check if string contains
Quote:
Ok but how i can specify in your code the arg which to read for example 1, 2 or 3 Cause your code is: read_args and can't specify the arg which needs to be read like is Code:
static arg_reason[ 70 ];i need this: amx_ban "STEAM_ID" 5 "reason" So steam_id and reason require for double quotes! Thanks. P.S - i found this it works to require for ARG 1 and 2 and only ARG 2 Code:
bool:Quotes_req_arg12() |
Re: pawn check if string contains
What variations do you need?
I gave you: command <no quotes> <quotes> |
Re: pawn check if string contains
This will get the full argument, including the quotes. There may be a native that I don't know about that does this. Not thoroughly tested.
Input: amx_test "123" 456 "789" "1" Output: Code:
4 argsPHP Code:
|
Re: pawn check if string contains
Thanks for reply.
I don't want to bother you but i am new to pawn coding so i have to learn. Look this is what i have: Code:
#include <amxmodx> |
| All times are GMT -4. The time now is 06:17. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.