AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [stocks] String stocks (https://forums.alliedmods.net/showthread.php?t=53539)

teame06 04-05-2007 23:26

[stocks] String stocks
 
Here are some string stocks I found useful that I created in sourcepawn. It only works on string type variables

Code:
stock UTIL_StrToLower(String:Source[]) {     new len = strlen(Source);     for(new i = 0, b; i < len; i++)     {         b = Source[i];         if(b >= 65 && b <= 90)         {             Source[i] += (1<<5);         }     }     return 1; } stock UTIL_StrToUpper(String:Source[]) {     new len = strlen(Source);     for(new i = 0, b; i < len; i++)     {         b = Source[i];         if(b >= 97 && b <= 122)         {             Source[i] -= (1<<5);         }     }     return 1; } stock UTIL_IsSpace(ch) {     if(ch == 32)     {         return 1;     }     return 0; }


All times are GMT -4. The time now is 05:56.

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