# How to take a string and convert it into a int in swift 3 for text that is being segued

**URL:** <https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860>\
**Category:** Swift\
**Created:** [January 5, 2017, 7:59pm UTC](https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860 "2017-01-05T19:59:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zalubski](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zalubski/32/81494_2.png) [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Post date:** [January 5, 2017, 7:59pm UTC](https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860/1 "2017-01-05T19:59:02Z")

</div>

I would like to take lebelText and divide it by 2. Then reconvert the result to a String so it can be displayed in viewdidload. lebelText is being segued.

```
      import UIKit

    class restultViewController: UIViewController {

     @IBOutlet var dxe: UILabel!

     var LebelText = String()

        override func viewDidLoad() {
        super.viewDidLoad()
        dxe.text = LebelText

        }

        override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
     // Dispose of any resources that can be recreated.
  }}

```

---

<div class="post-metadata">

**Author:** ![aeberbach](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/aeberbach/32/81494_2.png) [@aeberbach](https://forums.kodeco.com/u/aeberbach)\
**Post date:** [January 5, 2017, 10:51pm UTC](https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860/2 "2017-01-05T22:51:51Z")

</div>

It’s an initialiser, which looks like a cast:

```
let value = 123
let stringValue = String(value)
let intValue = Int(stringValue)

```
