0

In , urlContentArray[1].componentsSeparatedByString("")

I want to replace the "1" with a range of numbers.

When I write urlContentArray[1..")

I get this error message:

Value of type 'ArraySlice' has no member 'componentsSeparatedByString'

How can get I get range of numbers?

xyz qwerty
  • 57
  • 11
  • 3
    Possible duplicate of http://stackoverflow.com/questions/33060238/how-to-get-a-subarray-from-swift-2-0 – Eric Aya Jul 20 '16 at 16:43

1 Answers1

0

urlContentArray is an array. When you use urlContentArray[1] it returns a String.

So you can split by using split method as discussed in this post.

But when you do urlContentArray[1..3] or any range, it returns an array. And array does not have any method named componentsSeparatedByString. That is the reason you are getting the error.

Community
  • 1
  • 1
triandicAnt
  • 1,328
  • 2
  • 15
  • 40