【问题标题】:string append to array in swift字符串快速追加到数组
【发布时间】:2017-07-24 08:45:06
【问题描述】:

我是快速编程的新手

在弹出菜单选择后调用这个函数

   func didSelectData(_ result: String){

    self.attendanceInfo.removeAll()
        if(result == "All Student"){
            self.attendanceInfo = self.attendanceInfoDupilicate
        }
        else if(result == "Present Student" ){
            self.attendanceInfo.removeAll()
            let itemsarray = self.attendanceInfoDupilicate
            for AttendanceInfo in itemsarray {
                if(AttendanceInfo.attendance.range(of: "PRESENT", options: .caseInsensitive) != nil){
                    self.attendanceInfo.append(AttendanceInfo)
                }
            }
        } else{
            self.attendanceInfo.removeAll()
            let itemsarray = self.attendanceInfoDupilicate
            for AttendanceInfo in itemsarray {
                if(AttendanceInfo.attendance.range(of: "ABSENT", options: .caseInsensitive) != nil){
                    self.attendanceInfo.append(AttendanceInfo)
===========>.  I have to append the  attendance = ""; to AttendanceInfo  
                } 
            }
        }
        self.TableView.reloadData()
       }

服务调用后Json数据为

我正在展示 出席=现在 出席=缺席

但是如何追加

的json数据

出席 = "";到 didSelectData 的函数

请帮帮我

【问题讨论】:

    标签: arrays swift swift3


    【解决方案1】:

    试试

    if (AttendanceInfo.attendance.range(of: "ABSENT", options: .caseInsensitive) != nil) || AttendanceInfo.attendance.isEmpty {
    
    }
    

    【讨论】:

      猜你喜欢
      • 2016-12-03
      • 1970-01-01
      • 1970-01-01
      • 2013-07-04
      • 2016-05-28
      • 2016-03-02
      • 1970-01-01
      • 2016-11-27
      • 1970-01-01
      相关资源
      最近更新 更多