Quote:
Originally Posted by Dwane
There is a way.
pawn Код:
// Normal split function, I just added a second delimiter stock split(const strsrc[], strdest[][], delimiter1, delimiter2) { new i, li; new aNum; new len; while(i <= strlen(strsrc)) { if((strsrc[i] == delimiter1 || strsrc[i] == delimiter2)|| i == strlen(strsrc)) { len = strmid(strdest[aNum], strsrc, li, i, 128); strdest[aNum][len] = 0; li = i+1; aNum++; } i++; } return 1; }
pawn Код:
main( ) { new maths_text[ 15 ], number_coords[ 3 ][ 3 ], tmpstr[ 32 ] ; format( maths_text, sizeof( maths_text ), "18-1+8" ); split( maths_text, number_coords, '+', '-' ); format( tmpstr, sizeof( tmpstr ), "maths: a = %s, b = %s, c = %s", number_coords[ 0 ], number_coords[ 1 ], number_coords[ 2 ] ); print( tmpstr ); }
pawn Код:
// Output: [23:14:36] maths: a = 18, b = 1, c = 8
|
thank you so much !!!!!!!!!!!!!!!!!!!!!!!!