Prev Previous Post   Next Post Next
Old 09-19-2016, 04:39 PM   #1
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,798
Default Q: Parse CSV file with JSFX

Hi,

I am a bit confused that string format and function in JSFX.

imagine a file like
Code:
45-50
40-51
68-98
The seperator - can be replace with any other separator.


Here is the code for sampling a file (from MIDI Pattern/Scale Variation Generator [IXix])
Code:
@slider
seqFile != slider8 ?
(
  seqFile = slider8;
  seqSize = 0;
  fileHandle = file_open(slider8);
  fileHandle > 0 && file_text(fileHandle) ?
  (
    while
    (
      file_var(fileHandle,seq[seqSize]);
      file_avail(fileHandle) ? seqSize += 1;
    );
    file_close(fileHandle);
  );
);
You can then access a line with seq[x] where x is the number of the line.

But how will you return two variables from that line ? How would you parse the "45-50" into two int variable ?
I only succeed to get int when there is only one number per line, but not two with a sperator.

Thanks for your help !

Last edited by X-Raym; 09-19-2016 at 07:30 PM.
X-Raym is offline   Reply With Quote
 

Thread Tools
Display Modes

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 -7. The time now is 12:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.