我想在3个标签中显示单词字符串中的金额.... [英] i want to make amount in word string to show in 3 labels....

查看:57
本文介绍了我想在3个标签中显示单词字符串中的金额....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:



Rs.12,522,554.25

(一千二百五十二百五十五百五十五四和五分)只有)





我想在3个标签中显示这个,



label1:一千二百五十二二

label2:一千五百五十四和二十

label3:仅五美分



****************************************** ***

如果第一个标签超过第2个标签,

如果第二个标签超过第3个标签,

,我想要的是什么



****************************** ***************





我正在尝试编写支票编写软件,

所以我需要在支票上显示单词金额为3行。





请将其真实需要我...

任何人都可以帮助我。



[更新]

是的,仍然搜索这些主题。

转换是可以的。

bt spiting部分是问题。

Coz金额在单词中,字符串不断地通过3个标签。

有我困惑的地方。



如果我键入一小部分它显示在第1行中,当字符串变长时,它必须显示在第1行,剩余部分显示在第2行。

解决方案

这看起来像HomeWork。

您应该能够自己设置一些东西,这是一项简单的任务。



引用:

我在谷歌检查了很多,很多网站......都找不到任何解决方案

这简直令人难以置信。我的Google搜索在第一页的答案中提供了4个解决方案。

我想你真的需要学习如何使用Google。



你的问题是2个无关的问题

1)转换

2)线路拆分

每个问题在互联网上都有很多解决方案。如果你想找到一个结合两者的现成解决方案,那么找到它可能会更复杂。

你能说明你做了什么谷歌搜索吗?



[更新]

换行:

所有问题都是字符大小可变。

如果可以打印字符串到一个具有足够高度的字段,激活一个LineWrap模式应该可以做到这一点。

否则,你的字段应该有一个方法,给你一个字符串的宽度,你看它是否适合通过比较字段宽度。

谷歌类似字符串宽度适合

需要了解有关您复制到的字段的更多详细信息。


一旦你用印地语 - 乌尔都语货币符号表达你的英语音译,为什么不简单地使用一个标签:



1.设置它'AutoSize属性取决于您的UI设计。



2.根据您的UI设计设置其'TextAlign属性。



3.为其分配一个带换行符的字符串,例如:

 lbl_IndiaCurrecyFormatToEnglish.Text =  一千二百五十二十五十五百五十四和二十五分之五只; 

如果你想使用多个标签,你可以这样做。



  //  一个标签可容纳的最大字符数 
int maxLen = 50 ;

// 测试字符串
string text = 一千二百五十二万五千五百四十四只有二​​十五分;

List< string> parts = new List< string>();
执行
{
if (text.Length < maxLen)
{
parts.Add(text);
break ;
}

// 找到最接近结尾的单词break(space)字符串
int len;
for (len = maxLen; len > = 0 ; len--)
{
if (text [len] == ' '
break ;
}

parts.Add(text.Substring( 0 ,len));

// 分配字符串的左侧
text = text.Substring(len + 1);

} while true );

label1.Text =(parts.Count > 0 )?部件[ 0 ]: ;
label2.Text =(parts.Count > 1 )?部件[ 1 ]: ;
label3.Text =(parts.Count > 2 )?部件[ 2 ]: ;


For Example :

Rs.12,522,554.25
(Twelve Million Five Hundred and Twenty Two Thousand Five Hundred and Fifty Four and Five Cents Only)


I want to show this in 3 labels as,

label1: Twelve Million Five Hundred and Twenty Two
label2: Thousand Five Hundred and Fifty Four and Twenty
label3: Five Cents Only

*********************************************
if the 1st label exceed it goes to 2nd label,
if 2nd label exceed it goes to 3rd label,
that,s what i want

*********************************************


I am trying to make a cheque writing software,
so i need to show the amount in words as 3 line on the cheque.


Pls its realy needed to my..
anyone can help me.

[Update]
yes, still searching through these topics.
conversion is ok.
bt the spiting part is the problem.
Coz amount in words string continuously goes through 3 labels.
there is the place i am in confused.

if i type a small amount it shows in line 1, when the string gets longer it must show in 1st line and remaining are in line 2.

解决方案

This furiously look like HomeWork.
You should be able to device something by yourself, it is an easy task.

Quote:

i checked a lot in google, and many sites..couldn't find any solutions

It is simply unbelievable. My Google search gave 4 solutions in the first page of answers.
I guess you really need to learn how to use Google.

Your question is 2 unrelated questions
1) the conversion
2) the lines split
Each question have plenty of solutions on internet. if you look for a ready solution that combine both, it may be more complicated to find.
Can you show what Google search you have done?

[Update]
for the lines split:
All the problem is that chars are variable size.
if you can print the string to a fields with enough height, activating a LineWrap mode should do the trick.
Otherwise, your field should have a method that gives you the width of a string and you see if it fit by comparing with the width of field.
Google with something like string width fit
Need to know more details about the field you copy to.


Once you have your transliteration to English from Hindi-Urdu currency notation working, why not simply use one Label:

1. Set its 'AutoSize property depending on your UI design.

2. Set its 'TextAlign property depending on your UI design.

3. Assign a single string with line-breaks to it, example:

lbl_IndiaCurrecyFormatToEnglish.Text = "Twelve Million Five Hundred and Twenty Two\nThousand Five Hundred and Fifty Four and Twenty\nFive Cents Only";


If you want to use several labels you do it this way.

// The maximum number of characters one label can hold
int maxLen = 50;

// Test string
string text = "Twelve Million Five Hundred and Twenty Two Thousand Five Hundred and Fifty Four and Twenty Five Cents Only";

List<string> parts = new List<string>();
do
{
    if (text.Length < maxLen)
    {
        parts.Add(text);
        break;
    }

    // Find the word break (space) closest to the end of the string
    int len;
    for (len = maxLen; len >= 0; len--)
    {
        if (text[len] == ' ')
            break;
    }

    parts.Add(text.Substring(0, len));

    // Assign the left over of the string
    text = text.Substring(len+1);

} while (true);

label1.Text = (parts.Count > 0) ? parts[0] : "";
label2.Text = (parts.Count > 1) ? parts[1] : "";
label3.Text = (parts.Count > 2) ? parts[2] : "";


这篇关于我想在3个标签中显示单词字符串中的金额....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆