BitmapToWeekdays converts a bitmap to a list of weekdays in accordance with the schedule package's rules (see above).
(bitmap uint8)
| 102 | // BitmapToWeekdays converts a bitmap to a list of weekdays in accordance with |
| 103 | // the schedule package's rules (see above). |
| 104 | func BitmapToWeekdays(bitmap uint8) []string { |
| 105 | days := []string{} |
| 106 | for i := 0; i < 7; i++ { |
| 107 | if bitmap&(1<<i) != 0 { |
| 108 | switch i { |
| 109 | case 0: |
| 110 | days = append(days, "monday") |
| 111 | case 1: |
| 112 | days = append(days, "tuesday") |
| 113 | case 2: |
| 114 | days = append(days, "wednesday") |
| 115 | case 3: |
| 116 | days = append(days, "thursday") |
| 117 | case 4: |
| 118 | days = append(days, "friday") |
| 119 | case 5: |
| 120 | days = append(days, "saturday") |
| 121 | case 6: |
| 122 | days = append(days, "sunday") |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | return days |
| 127 | } |
| 128 | |
| 129 | var AllDaysOfWeek = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"} |
| 130 |
no outgoing calls