View Single Post
Old 06-03-2016, 06:28 AM   #86
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default

Split string in array:
Code:
function splitString(str,sep,arr) 
local(i,pos) (
  i=pos=0;
  #reg="%S";
  #reg+=sep;
  #reg+="*";
  string_pos+=1;
  len=strlen(str);
  while (match(#reg,strcpy_from(#,str,pos),string_pos) && i<555) (
    arr[i]=string_pos;
    pos+=strlen(string_pos)+1;
    i+=1;
    string_pos+=1;
  );
  pos>0 ? arr[i]=strcpy_from(string_pos,str,pos);
);

arr1=0;
splitString("C;C#;D;D#;E;F;F#;G;G#;A;A#;B",";",arr1);
SaschArt is offline   Reply With Quote