AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   SubString (https://forums.alliedmods.net/showthread.php?t=219531)

Dr. McKay 06-30-2013 01:15

SubString
 
This should really be included in the incs, or at the very least in smlib.

PHP Code:

stock SubString(const String:input[], poslengthString:output[], maxlen) {
    for(new 
0<= lengthi++) {
        if(
>= maxlen || == length) {
            
output[i] = '\0';
            return;
        }
        
output[i] = input[pos i];
    }



DJ Tsunami 06-30-2013 04:14

Re: SubString
 
PHP Code:

strcopy(outputlength 1input[pos]); 

strcopy adds \0 itself.


All times are GMT -4. The time now is 18:38.

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