Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock getPartOfStringEx(const string[], dest[], strpos=0, sep=' ', secondsep=256) { //by FoxHound
- new delstr[256],count[2]={0,...}; secondsep = (secondsep!=256) ? secondsep : sep;
- format(delstr,256,"%s",string);
- for(new i[2]={0,...}; i[0]<strlen(delstr); i[0]++) {
- if(delstr[i[0]]==sep) {
- count[1]++;
- if(((count[0]+1)==strpos) && !i[1]) { strdel(delstr,0,i[0]+1),i={0,1},sep=secondsep; continue; }
- else if(i[1]) { strdel(delstr,i[0],strlen(delstr)); }
- else { count[0]++; continue; } } }
- if(count[1]<strpos) { delstr="\0"; }
- format(dest,64,"%s",delstr); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement