小编Sid*_*gam的帖子

如何在 Flutter 中确定十二生肖

我怎样才能在颤振中写这个?我已经用 swift 制作了这个应用程序,现在我正在 flutter 中制作该应用程序,什么是获取十二生肖的最佳方法。谢谢

let calendar = Calendar.current
    let d = calendar.component(.day, from: date)
    let m = calendar.component(.month, from: date)

    switch (d,m) {
    case (21...31,1),(1...19,2):
        return "aquarius"
    case (20...29,2),(1...20,3):
        return "pisces"
    case (21...31,3),(1...20,4):
        return "aries"
    case (21...30,4),(1...21,5):
        return "taurus"
    case (22...31,5),(1...21,6):
        return "gemini"
    case (22...30,6),(1...22,7):
        return "cancer"
    case (23...31,7),(1...22,8):
        return "leo"
    case (23...31,8),(1...23,9):
        return "virgo"
    case (24...30,9),(1...23,10):
        return "libra"
    case (24...31,10),(1...22,11):
        return "scorpio"
    case (23...30,11),(1...21,12):
        return "sagittarius"
    default:
        return "capricorn"
    }
Run Code Online (Sandbox Code Playgroud)

flutter

5
推荐指数
2
解决办法
1285
查看次数

在iOS Swift中进行字符串编辑

我有一个字符串,其中有一个标签</ p>,我想在</ p>之前附加</ b>

let str = "<p>A new week-long event is kicking off soon in <a href="/pokemon-go/" data-ref-id="5000-449545">Pokemon Go</a>. Niantic is holding another Adventure Week beginning Tuesday, June 4, and it'll give players a chance to earn extra rewards, catch some rare Rock-types, and even find a couple of new Shiny Pokemon.</p><p>During Adventure Week, Geodude, Rhyhorn, Omanyte, Aron, Lileep, Anorith, and other Rock Pokemon will appear in the wild much more frequently than normal.</p>"
Run Code Online (Sandbox Code Playgroud)

我希望此字符串为:

let newStr = #"<b><p>A …
Run Code Online (Sandbox Code Playgroud)

string ios swift

-1
推荐指数
1
解决办法
78
查看次数

标签 统计

flutter ×1

ios ×1

string ×1

swift ×1