[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-------+##################################################################
#+-| VAL() |-----------------------------------------------------+############
#| +-------+ Converts source_string to a double-precision number |############
#+---------------------------------------------------------------+############
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |----------------------------------+#############################
#| FUNCTION DBL val PROTOTYPE |#############################
#| PARAMETERS CONST CHAR source_string |#############################
#+----------------------------------------------+#############################
##############################################################################
##############################################################################
######+---| Description |-----------------------------------------------+#####
######| The val() function converts source_string to a double-precision |#####
######| number. Use val() function if it is neccessary to have great |#####
######| precision. For general use, and for speed increase, us the |#####
######| i_val() function. |#####
######+-----------------------------------------------------------------+#####
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Get sampling data from a text file. |#########
#########| |#########
#########| VARDEF |#########
#########| CHAR input_char |#########
#########| DBL z[100] |#########
#########| ENDDEF |#########
#########| |#########
#########| {...} |#########
#########| i = 0 |#########
#########| DO WHILE .NOT. f_eof( file_var ) |#########
#########| f_getln( file_var, input_char ) |#########
#########| z[i] = val( ltrim( input_char ) ) |#########
#########| i = i + 1 |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Have user input quantity+description. |#########
#########| |#########
#########| ACCEPT "Type: <quantity+description> " TO getit |#########
#########| !z REPLACE z->quan WITH val( ltrim( getit ) ), ; |#########
#########| z->desc WITH substr( getit, at( "+", getit),; |#########
#########| + 1 len( getit ) - at ( "+", getit ) ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
i_str()
i_val()
str()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson