C#舍入到小数点后两位

时间:2020-07-18 15:53:24

标签: c# linq

在这种情况下,如何舍入到小数点后两位。这不起作用

      List<decimal> abc = new List<decimal> { 500, 500 };
      List<decimal> abcd = new List<decimal> { 12, 100 };
      var cd = string.Join(",",  abc.Zip(abcd, (q1, q2) => ((Math.Round(q2,2) / Math.Round(q1, 2)) * 100));

1 个答案:

答案 0 :(得分:1)

请在您的问题上添加例外结果和目的。 检查一下:

const prefix = '!'
client.on("message", async message => {
    if (message.author.bot) return;
    if (message.content.indexOf(prefix) !== 0) return;
    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
    if (command == 'mute') {
        if (!args[1].endsWith('s') && !args[1].endsWith('m')) {
            return message.channel.send('Please specify seconds or minutes!');
        } else {
            message.channel.send('mute applied. time : ' + args[1]))
        }
    }
});