Skip to main content
edited body; edited title
Source Link
Cœur
  • 39k
  • 25
  • 207
  • 282

How do iI get the last value in a string separated by commas?

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperatedseparated by a "," which in this case would be 10, and its not necessarily a two digit value.

I tried this:

var data = 123,456,7,8,9,10 data = data.last! 

How do i get the last value in a string separated by commas?

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperated by a "," which in this case would be 10, and its not necessarily a two digit value.

I tried this:

var data = 123,456,7,8,9,10 data = data.last! 

How do I get the last value in a string separated by commas?

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value separated by a "," which in this case would be 10, and its not necessarily a two digit value.

I tried this:

var data = 123,456,7,8,9,10 data = data.last! 
added 81 characters in body
Source Link
Lojas
  • 205
  • 4
  • 13

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperated by a "," which in this case would be 10, and its not necessarily a two digit value.

I tried this:

var data = 123,456,7,8,9,10 data = data.last! 

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperated by a "," which in this case would be 10, and its not necessarily a two digit value.

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperated by a "," which in this case would be 10, and its not necessarily a two digit value.

I tried this:

var data = 123,456,7,8,9,10 data = data.last! 
Post Closed as "Duplicate" by Nitin Gohel, user3151675, Eric Aya swift
Source Link
Lojas
  • 205
  • 4
  • 13

How do i get the last value in a string separated by commas?

I have this string

let data = 123,456,7,8,9,10 

I want to extract the last value seperated by a "," which in this case would be 10, and its not necessarily a two digit value.