问答详情
源自:4-1 Swift-String和Character

countElements在最新版的语法中是不是改成count了???然后现在的count方法要怎么使用

countElements在最新版的语法中是不是改成count了???然后现在的count方法要怎么使用

提问者:Epps 2015-04-25 11:45

个回答

  • 美丽的亦航
    2017-03-21 17:43:56

    学习到了,O(∩_∩)O谢谢

  • DEXXR
    2016-04-17 17:59:47

    let strValue1 = "床前明月光,疑是地上霜"

    for c in strValue1.characters

    {

        print(c)

    }

    print("字数是:\(strValue1.characters.count)")


  • DEXXR
    2016-04-17 17:51:10

    可是我发现:

    let strValue1 = "床前明月光,疑是地上霜"

    for c in strValue1.characters

    {

        print(c)

    }


    这样也能输出!

  • callmezou
    2016-01-29 14:01:39

    str.characters.count


  • 崖址山
    2016-01-19 08:53:10

    str.characters.count


  • 西风322
    2015-12-31 02:37:47

    改了好多次。。希望早点稳定下来啊  

  • 括号扯蛋侠
    2015-11-16 16:32:09

    var str = "Hello, playground"

    str.characters.count

    for c in str.characters{

        print(c)

    }


  • fc棒棒哒
    2015-09-16 13:57:29

    countElements has been renamed to count

  • 赶猪的人
    2015-07-03 14:17:59

    到哪里去看更新的?

  • Loveway
    2015-07-01 17:04:43

     是的,改了

  • DayBreak
    2015-05-20 18:43:22

    same   count(s1)