Raised This Month: $32 Target: $400
 8% 

Alphanumeric check


Post New Thread Reply   
 
Thread Tools Display Modes
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 10-21-2012 , 03:16   Re: Alphanumeric check
Reply With Quote #11

when ever i use mp_tournament_redteamname/mp_tournament_blueteamname an check for only alphanumeric characters its always returning false :[
Nano2e is offline
BAILOPAN
Join Date: Jan 2004
Old 10-21-2012 , 03:18   Re: Alphanumeric check
Reply With Quote #12

Quote:
Originally Posted by Nano2e View Post
when ever i use mp_tournament_redteamname/mp_tournament_blueteamname an check for only alphanumeric characters its always returning false :[
try strlen(str) instead of sizeof(str)
__________________
egg
BAILOPAN is offline
BAILOPAN
Join Date: Jan 2004
Old 10-21-2012 , 03:20   Re: Alphanumeric check
Reply With Quote #13

Quote:
Originally Posted by Predailien12 View Post
Hey. I have some question.

I want to make some extension to make 64-bit integer or something.

could you please, inform me where to learn the basic..?
Sure - could you make a new thread and describe what you're hoping to do in a little more detail?
__________________
egg
BAILOPAN is offline
Nano2e
SourceMod Donor
Join Date: Apr 2012
Location: Australia
Old 10-21-2012 , 03:24   Re: Alphanumeric check
Reply With Quote #14

awesome it seems to have done the trick ty bail
Nano2e is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-21-2012 , 09:29   Re: Alphanumeric check
Reply With Quote #15

Quote:
Originally Posted by BAILOPAN View Post
This function is UTF-8 safe, because out-of-range bytes will fail the character class tests.
But there are a lot of alphabetic characters outside of ASCII range.
__________________
FaTony is offline
BAILOPAN
Join Date: Jan 2004
Old 10-21-2012 , 14:56   Re: Alphanumeric check
Reply With Quote #16

Quote:
Originally Posted by FaTony View Post
But there are a lot of alphabetic characters outside of ASCII range.
Sure. He/she can decide whether it matters for their use case.
__________________
egg
BAILOPAN is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 09-15-2015 , 14:51   Re: Alphanumeric check
Reply With Quote #17

Quote:
Originally Posted by 11530 View Post
Code:
stock bool:IsAlphaNumeric(const String:str[])
{
	for (new i = 0; i < sizeof(str); i++)
	{
		if (!IsCharAlpha(str[i]) && !IsCharNumeric(str[i]))
		{
			return false;
		}
	}
	return true;
}
Edit: Use strlen(str) instead of sizeof(str)
I know this thread is old af, but thank you for making this snippet <3
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 09-15-2015 , 17:26   Re: Alphanumeric check
Reply With Quote #18

Quote:
Originally Posted by DJ Data View Post
I know this thread is old af, but thank you for making this snippet <3
You're welcome, though just want to reiterate the edit I made in that post since it looks tiny - just in case someone directly copy/pastes

Quote:
Originally Posted by 11530 View Post
Use strlen(str) instead of sizeof(str)
__________________

Last edited by 11530; 09-15-2015 at 17:28. Reason: Deleted
11530 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode