荷蘭政府IT狗教你點寫 進度條

漢語多功能字庫

171 回覆
398 Like 7 Dislike
漢語多功能字庫 2023-01-21 02:33:38


private static string GetPercentageRounds(double percentage)
        {
            if (percentage == 0)
                return "⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪";
            if (percentage > 0.0 && percentage <= 0.1)
                return "🔵⚪⚪⚪⚪⚪⚪⚪⚪⚪";
            if (percentage > 0.1 && percentage <= 0.2)
                return "🔵🔵⚪⚪⚪⚪⚪⚪⚪⚪";
            if (percentage > 0.2 && percentage <= 0.3)
                return "🔵🔵🔵⚪⚪⚪⚪⚪⚪⚪";
            if (percentage > 0.3 && percentage <= 0.4)
                return "🔵🔵🔵🔵⚪⚪⚪⚪⚪⚪";
            if (percentage > 0.4 && percentage <= 0.5)
                return "🔵🔵🔵🔵🔵⚪⚪⚪⚪⚪";
            if (percentage > 0.5 && percentage <= 0.6)
                return "🔵🔵🔵🔵🔵🔵⚪⚪⚪⚪";
            if (percentage > 0.6 && percentage <= 0.7)
                return "🔵🔵🔵🔵🔵🔵🔵⚪⚪⚪";
            if (percentage > 0.7 && percentage <= 0.8)
                return "🔵🔵🔵🔵🔵🔵🔵🔵⚪⚪";
            if (percentage > 0.8 && percentage <= 0.9)
                return "🔵🔵🔵🔵🔵🔵🔵🔵🔵⚪";

            return "🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵";
        }

https://github.com/MinBZK/woo-besluit-broncode-digid-app/blob/ad2737c4a039d5ca76633b81e9d4f3f9370549e4/Source/DigiD.iOS/Services/NFCService.cs#L182
日日打丁 2023-01-21 02:34:20
英國廢青 2023-01-21 02:35:33
第一次打CODE嘅話OK嘅
每天不開心 2023-01-21 02:36:58
計行數收錢你識咩
簡單隨緣 2023-01-21 02:39:05
hi
怠惰 2023-01-21 02:39:58
KISS principle
Keep it simple, stupid
簡單隨緣 2023-01-21 02:40:06
my style
127.0.0.1 2023-01-21 02:41:39
用眼睇都知冇bug
ApacheHelicopter 2023-01-21 02:43:53
唔係點寫
米拉·瓦勒里 2023-01-21 02:49:51
睇番Github先明有咩唔好

原來係 percentage 未到 1 ,只要超過 0.9 都當 full ,搵笨
Playboy型毒撚 2023-01-21 03:01:58
係喎
妳是我心上人 2023-01-21 03:08:42
有沒有one-liner
簡單隨緣 2023-01-21 03:14:50
return "" + percentage;
MKMP213世一好J 2023-01-21 03:16:48
老細同客:理得你方法點 做到得啦
公屋vip 2023-01-21 03:23:23
啊倫 2023-01-21 03:36:13
到左100% 就唔使進度條, 直接完
Masterbaits 2023-01-21 03:43:35
use binary search
ぐだぐだ 2023-01-21 03:48:17
外國:Simple is beauty
香港:又邊條弱智it dog整
網蛇 2023-01-21 03:48:47
進度除0.1 之後ceil左佢
再用switch或者array搵output
網蛇 2023-01-21 03:51:29
如果output有pattern
直接用for loop gen個output
我愛Python 2023-01-21 04:09:32
print(‘🔵’ * math.floor(percentage * 10) + ‘⚪️’ * 10 - math.floor(percentage * 10))
帳號註冄 2023-01-21 08:54:49
外國樓主:Simple is beauty
香港正常人:又邊條弱智it dog整
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞