check columns that should be displayed
(showNumL, hideNumL []int, colLen int)
| 778 | |
| 779 | // check columns that should be displayed |
| 780 | func getVisCol(showNumL, hideNumL []int, colLen int) ([]int, error) { |
| 781 | for _, i := range showNumL { |
| 782 | if i > colLen || i <= 0 { |
| 783 | return nil, errors.New("Column number " + I2S(i) + " does not exist") |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | for _, i := range hideNumL { |
| 788 | if i > colLen || i <= 0 { |
| 789 | return nil, errors.New("Column number " + I2S(i) + " does not exist") |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | var visCol []int |
| 794 | for i := 0; i < colLen; i++ { |
| 795 | flag, err := checkVisible(showNumL, hideNumL, i) |
| 796 | if err != nil { |
| 797 | return nil, err |
| 798 | } |
| 799 | if flag { |
| 800 | visCol = append(visCol, i) |
| 801 | } |
| 802 | } |
| 803 | return visCol, nil |
| 804 | |
| 805 | } |
| 806 | |
| 807 | // check ith column should be displayed or not |
| 808 | func checkVisible(showNumL, hideNumL []int, col int) (bool, error) { |