0

Essentially I have the following UIPickerView array that I am using to allow the user to easily POST values to JSON. The issue is I only need the numeric value to be sent not including the word "Page"

let stopPickerValues = ["Tap to Select Page #","Page 1", "Page 2", 
"Page 3", "Page 4", "Page 5", "Page 6", "Page 7", "Stop 8", "Stop 9", "Page 10"]

How can I show the word Page as a selection in the UIPickerView but only include the number once a value is selected?

Harsh Pipaliya
  • 2,260
  • 1
  • 14
  • 30

1 Answers1

0

You can try

let selectedStr = stopPickerValues[row]
let str = selectedStr.components(separatedBy: CharacterSet.decimalDigits.inverted).first
print(str)
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87