Day11 swift2.0-string

Source: Internet
Author: User

**day 11

**swift 2.0 String

var arr = [1,"2",3.3]

Print("\(arr)")

var dict = ["A":1,"B":2,"C":3]

(dict as nsdictionary). AllKeys

(dict as nsdictionary). Allvalues

var string = "Hello world!"

Let range = string. StartIndex. <string. StartIndex. Advancedby(5)

String. Replacerange(range, with: "Hi")

String

Print("\(string)")

Let range2 = string. EndIndex. Advancedby(-6). <string. EndIndex

String. Substringwithrange(range2)

var animals = "\u{1f60e}hoho~"

Animals. Characters. Count

var swift_string = "symbol2.0"

Let string2 = swift_string + "ahaha~"

Print("\(string2)")

Swift_string

Swift_string. Appendcontentsof("addstring")

Print("\(swift_string)")

var i = 1

For ;  i <= ; {

I*i

I + = 1

}

For var a =-6.28 ; a <= 6.28 ; a + = 0.2 {

sin(a)

cos(a)

Tan(a)

1/Tan(a)

}

var newstring = "Hello world!"

For var c in newstring. Characters {

Print("\(c)")

if c = = "R" {

c = ""

Print("\(newstring. EndIndex) ")

}

Print("\(c)")

}

Print("\(newstring)")

Day11 swift2.0-string

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.