Raised This Month: $ Target: $400
 0% 

[Requesting Add AMXX] Some Usefull String Functions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 11-01-2004 , 22:12  
Reply With Quote #7

Small Changes (Mentioned/added in another post, thought I would put it here too)..

Code:
stock ExplodeString( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter ) {     new nIdx = 0, l = strlen(p_szInput)     new nLen = (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ))     while( (nLen < l) && (++nIdx < p_nMax) )         nLen += (1 + copyc( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ))     return nIdx }

Now returns the number of exploded strings returned in the p_szOutput array.. Useful for looping through results afterwards..

p_nMax & p_nSize correspond to the 2D p_szOutput Array sizes respectively..

Example:
Code:
new LongString[64] = "Some.Long.String.Seperated.by.Periods" // 10 Strings of Length 16 new ExplodedStrings[10][16] // Explode By Delimiter: '.' = Period (Dot) new Count = ExplodeString( ExplodedStrings, 10, 16, LongString, '.' ) // output of Count will be 6 // output of array: ExplodedStrings // // ExplodedStrings[0] = "Some" // ExplodedStrings[1] = "Long" // ExplodedStrings[2] = "String" // ExplodedStrings[3] = "Seperated" // ExplodedStrings[4] = "by" // ExplodedStrings[5] = "Periods"
xeroblood is offline
Send a message via MSN to xeroblood
 



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 14:47.


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