Jump to content

Days of the week and inserting "&"


rpaterick

Recommended Posts

sample data attached.

 

There are either single days or multiple days that could be shown.

 

Single day would look like: MONDAY

Multiple days would look like: ex: TUESDAY & THURSDAY & SATURDAY

 

Based on the attached data file, how could I have it convert the "numbers" into days plus add "&" only when it has multiple days? Numbers are not always the same code.

 

Thanks!:confused:

test.txt

Link to comment
Share on other sites

var DayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var result = new Array();
for (var i = 0; i < 7; i++)
{
 if (Field(DayNames[i].substr(0, 2)))
   result.push(DayNames[i].toUpperCase());
}
return result.join(" & ");

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...