Advertisement
luisgustavomiki

[FUNC] explode

Sep 22nd, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.65 KB | None | 0 0
  1. // explode - credits go to whoever made this.
  2. explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // Created by Westie
  3. {
  4.     new
  5.         iNode,
  6.         iPointer,
  7.         iPrevious = -1,
  8.         iDelimiter = strlen(sDelimiter);
  9.  
  10.     while(iNode < iVertices)
  11.     {
  12.         iPointer = strfind(sSource, sDelimiter, false, iPointer);
  13.  
  14.         if(iPointer == -1)
  15.         {
  16.             strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
  17.             break;
  18.         }
  19.         else
  20.         {
  21.             strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
  22.         }
  23.  
  24.         iPrevious = (iPointer += iDelimiter);
  25.         ++iNode;
  26.     }
  27.     return iPrevious;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement