converting

Hi,
I have been working and getting along pretty well in pascal but i just encountered 2 problems that i couldn't do. I searched for some points in the book and on the net but i can't find the ones I want.

I would like to
- convert a string into an Integer;
- convert a string to real (which i know is similar to the above one)but specifying number of decimal points.

N.B I know how to convert a real number to string, will that help?


Thank you

Sweetfaith

Comments

  • : Hi,
    : I have been working and getting along pretty well in pascal but i just encountered 2 problems that i couldn't do. I searched for some points in the book and on the net but i can't find the ones I want.
    :
    : I would like to
    : - convert a string into an Integer;
    : - convert a string to real (which i know is similar to the above one)but specifying number of decimal points.
    :
    : N.B I know how to convert a real number to string, will that help?
    :
    :
    : Thank you
    :
    : Sweetfaith
    :
    For both problems, you'll need to use the Val() function. You cannot specify the number of decimals when converting strings into reals, other than type-casting the real as one of the real-types (i.e. single, real, double, extended). Pascal will automatically append decimal 0's to the number or remove everal decimal.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion