1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- $PBExportHeader$f_char_to_dec_workprice.srf
- global type f_char_to_dec_workprice from function_object
- end type
- forward prototypes
- global function decimal f_char_to_dec_workprice (string arg_computstr, integer arg_mxbt)
- end prototypes
- global function decimal f_char_to_dec_workprice (string arg_computstr, integer arg_mxbt);Decimal ld_dec_arr[],ld_dec_return
- Long ll_cnt
- Long ll_len,ll_i
- String ls_dec_tmp,ls_char_tmp
- Int ll_asc
- ld_dec_return = 0
- ll_len = lenA(arg_computstr)
- For ll_i = 1 To ll_len
- ls_char_tmp = midA(arg_computstr,ll_i,1)
-
- ll_asc = Asc(ls_char_tmp)
-
- If ll_asc >= 48 And ll_asc <= 57 Then
- //0~9
- ls_dec_tmp = ls_dec_tmp + ls_char_tmp
-
- If ll_i < ll_len Then
- Continue
- End If
- ElseIf ll_asc = 46 Then
- //asc 46 = '.'
- If Trim(ls_dec_tmp) = '' Then
- If ll_i < ll_len Then
- Continue
- End If
- Else
- ls_dec_tmp = ls_dec_tmp + ls_char_tmp
- If ll_i < ll_len Then
- Continue
- End If
- End If
- End If
-
-
- If Trim(ls_dec_tmp) <> '' Then
- If Mid(ls_dec_tmp,Len(ls_dec_tmp),1) = '.' Then
- ls_dec_tmp = Mid(ls_dec_tmp,1,Len(ls_dec_tmp) - 1)
- End If
-
- ll_cnt++
- ld_dec_arr[ll_cnt] = Dec(ls_dec_tmp)
- ls_dec_tmp = ''
- End If
-
- Next
- For ll_i = 1 To ll_cnt
- If ll_i = arg_mxbt Then
- ld_dec_return = ld_dec_arr[ll_i]
- End If
- Next
- Return ld_dec_return
- end function
|