【问题标题】:how to convert rupees to words in asp.net? [duplicate]如何将卢比转换为asp.net中的单词? [复制]
【发布时间】:2015-06-06 09:56:47
【问题描述】:

如何将卢比转换为字母 asp.net ? 我已经尝试了下面的代码,但没有奏效。 var formatted = d.ToString();

    if (formatted.Contains("."))
    {
        //If it contains a decimal point, split it into both sides of the decimal
        string[] sides = formatted.Split(".");

        //Process each side and append them with "and", "dot" or "point" etc.
        return NumberToWords(Int32.Parse(sides[0])) + " and " + NumberToWords(Int32.Parse(sides[1]));
    }
    else
    {
        //Else process as normal
        return NumberToWords(Convert.ToInt32(d));
    }

注意:我需要以下格式

例如:23,234.50 - 230234 卢比和 50 派萨。

【问题讨论】:

  • 定义“无效”。您是否记得实现了一个名为 NumberToWords 的方法,或者您认为编译器会为您执行此操作?

标签: asp.net


【解决方案1】:

试试这个

string amount = "58,765.50";//Here you will replace your value.
amount = amount.Replace(",", "");
string []sides = amount.Split('.');
string rupees = NumberToWords(int.Parse(sides[0])) + " And " + NumberToWords(int.Parse(sides[1])) + " paisa";

在这里,您将要转换为单词的数量。如果您的金额包含,,您需要将其替换为int。您还需要在. 上拆分金额,以便您可以分别获得rupeespaisa。比您需要将rupeespaisa 传递给函数并将它们连接起来以获得最终输出。

Here 是您可用于方法NumberToWords 的链接

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    • 2023-03-11
    • 2014-11-01
    • 2014-02-16
    • 2011-01-14
    • 2013-08-31
    相关资源
    最近更新 更多