| | |
How to write FNVAL functions
![]() |
•
•
Join Date: Jun 2004
Posts: 2
Reputation:
Solved Threads: 0
Dear sir,
This function converts a string to a numeric value. Provide two versions of this function overloading to return either a long or double value
Here is the pseudo code for the FNVAL processing
Validate the input string value
If it contains any non numeric characters, then throw a CSResult
Convert the string value and return either a long or a double result
please how to write the overload functions same parameter(passing only string) and returtype either double and long.
Thanks®ard
Sridhar
This function converts a string to a numeric value. Provide two versions of this function overloading to return either a long or double value
Here is the pseudo code for the FNVAL processing
Validate the input string value
If it contains any non numeric characters, then throw a CSResult
Convert the string value and return either a long or a double result
please how to write the overload functions same parameter(passing only string) and returtype either double and long.
Thanks®ard
Sridhar
•
•
Join Date: May 2004
Posts: 80
Reputation:
Solved Threads: 5
•
•
•
•
Originally Posted by bsridhar
...
This function converts a string to a numeric value.
...
Double.valueOf(String)
Long.valueOf(String)One approach would be to first try to convert the string to a long. If it works, then you have an integer. If it fails (i.e. throws an exception), then try to convert it to a double--maybe it was only a decimal point that caused the long conversion to fail. Success means it's a double, failure indicates a non-number string. After that, you'll have a long, a double or something that is neither, and you can do what you want with it.
•
•
•
•
Originally Posted by bsridhar
...
please how to write the overload functions same parameter(passing only string) and returtype either double and long.
...
![]() |
Similar Threads
- can we write queries in functions (MS SQL)
- UNIX Socket read/write functions (C++)
- Need Help with functions program (C++)
- Struct in Functions (C)
- please someone help me urgent (C++)
- Please some one write this program (C++)
- overload functions (C++)
Other Threads in the Java Forum
- Previous Thread: Vending machine
- Next Thread: Internal frames
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working





