Functions written by Informix 4GL to convert a string into a large write amount

Source: Internet
Author: User

#######################################
# The input amount of this function, returns the amount of uppercase Chinese characters ##
# Bellchiu AT NanJing CITIC: em13 :##
#######################################
FUNCTION F_CONV_GB (pf_money)
DEFINE pf_money DECIMAL (14,2)
DEFINE ll_money INTEGER
DEFINE I SMALLINT
DEFINE li_bit SMALLINT
DEFINE li_length SMALLINT
DEFINE li_len SMALLINT
DEFINE ls_money CHAR (20)
DEFINE ls_result CHAR (64)
DEFINE ls_arr_num ARRAY [10] of char (2)
DEFINE ls_arr_unit ARRAY [14] of char (2)
DEFINE ls_arr_unit0 ARRAY [14] of char (2)
LET ls_arr_num [1] = 'yi'
LET ls_arr_num [2] = 'er'
LET ls_arr_num [3] = 'san'
LET ls_arr_num [4] = 'Ta'
LET ls_arr_num [5] = 'wu'
LET ls_arr_num [6] = 'loan'
LET ls_arr_num [7] = 'hangzhou'
LET ls_arr_num [8] = 'hangzhou'
LET ls_arr_num [9] = 'hangzhou'
LET ls_arr_num [10] = '0'
LET ls_arr_unit [1] = 'quantity'
LET ls_arr_unit [2] = 'angular'
LET ls_arr_unit [3] = 'meta'
LET ls_arr_unit [4] = 'pick'
LET ls_arr_unit [5] = 'hangzhou'
LET ls_arr_unit [6] = 'hangzhou'
LET ls_arr_unit [7] = 'wan'
LET ls_arr_unit [8] = 'start'
LET ls_arr_unit [9] = 'hangzhou'
LET ls_arr_unit [10] = 'hangzhou'
LET ls_arr_unit [11] = '100%'
LET ls_arr_unit [12] = 'pick'
LET ls_arr_unit [13] = 'hangzhou'
LET ls_arr_unit [14] = 'hangzhou'
LET ls_arr_unit0 [1] = 'Integral'
LET ls_arr_unit0 [2] = '0'
LET ls_arr_unit0 [3] = 'meta'
LET ls_arr_unit0 [4] = '0'
LET ls_arr_unit0 [5] = '0'
LET ls_arr_unit0 [6] = '0'
LET ls_arr_unit0 [7] = 'wan'
LET ls_arr_unit0 [8] = '0'
LET ls_arr_unit0 [9] = '0'
LET ls_arr_unit0 [10] = '0'
LET ls_arr_unit0 [11] = '100'
LET ls_arr_unit0 [12] = '0'
LET ls_arr_unit0 [13] = '0'
LET ls_arr_unit0 [14] = '0'
IF pf_money = 0 THEN
RETURN 'zero RMB unifinalized'
END IF
IF pf_money <0 THEN
LET pf_money = 0-pf_money
LET ls_result = 'negative'
ELSE
LET ls_result =''
END IF
IF pf_money> 999999999999.99 THEN
RETURN ls_result = 'value out of range'
END IF
LET ls_money = pf_money * 100 USING "<"
LET li_length = length (ls_money CLIPPED)
For I = 1 to li_length
LET li_bit = ls_money [I]
If li_bit = 0 then
LET li_len = length (ls_result CLIPPED)
If ls_result [li_len-1, li_len] <> '0' then
LET ls_result = ls_result CLIPPED, ls_arr_unit0 [li_length-I + 1]
Else
LET ls_result = ls_result [1, li_len-2],
Ls_arr_unit0 [li_length-I + 1]
End if
Else
LET ls_result = ls_result CLIPPED, ls_arr_num [li_bit],
Ls_arr_unit [li_length-I + 1]
End if
END
Return ls_result CLIPPED
END FUNCTION

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.