JSFiddle - React, Tailwind, and code Playground

by briguy37

JavaScript

function getNotes(input){
    out='',lines=input.split('\n');
   
    for(col=0;lines[0][col++];){
        time=0;
        for(i=0;line=lines[i++];){
            char=line[col-1];
            if(char=='o')out+=(out?' ':'')+String.fromCharCode((lines.length+4-i)%7+65);
            if(char=='|')time=time||4;
            if(line[col]&&line[col]=='\\')time*=2;
        }
        if(time)out+='/'+time;
    }
    return out;
}

var input = 
"        |\\                  \n" + 
"----|\\--|------------------\n" + 
"|   |   |                   \n" +
"|---|---o---------------o---\n" + 
"|   o               |\\      \n" +
"o---------------|\\--|\\------\n" +
"            |\\  |\\  |\\      \n" +
"------------|\\--|\\--o------\n" +
"            |\\  o           \n" +
"------------o---------------";


    
alert(getNotes(input));

var notes=[],length=[];