Remove Empty Names

I'm trying to find a way to remove instances of empty names in my array. I was trying to find the indices to remove them but it does not print. I could use a little help.

Code Block
   func filterArr() {
    for (index, player) in cPlayerArr.enumerated() {
      if (player.yahooName == "") {
        print("Found \(player) at \(index)")
      }
    }
  }

Code Block
extension CurrentPlayers {
  @nonobjc public class func fetchRequest() -> NSFetchRequest<CurrentPlayers> {
    return NSFetchRequest<CurrentPlayers>(entityName: "CurrentPlayers")
  }
  @NSManaged public var photoUrl: String?
  @NSManaged public var firstName: String?
  @NSManaged public var lastName: String?
  @NSManaged public var position: String?
  @NSManaged public var team: String?
  @NSManaged public var yahooName: String?
  @NSManaged public var status: String?
  @NSManaged public var jerseyNumber: Int64
}
extension CurrentPlayers : Identifiable {
}

Answered by ZoneX in 667764022
I will close this thread I have a better idea.
I'm wondering how I can modify this function because it prints 0 for both arrays even though I call an API beforehand.

Code Block
   func filterArr() {
    cPlayerArrB = cPlayerArr.filter(){
      $0.yahooName != ""
    }
    print(cPlayerArr.count)
    print(cPlayerArrB.count)
  }

Accepted Answer
I will close this thread I have a better idea.

I will close this thread I have a better idea.

SOLVED does not mean closing. Please share your solution and mark it as SOLVED.
Remove Empty Names
 
 
Q