Hello,

I have a doubt, help
I made this snippet

String abuf = buf.charAt(nLen - 1);
        double ng = ::rtl::math::stringToDouble( abuf, '.', ',', NULL, NULL
);
        printf ( "Is : %i ", ng);

But the return value is 0, in theory I want to return the last digit of the
string

String : world1695
Is : 0
String : world3184
Is : 0

ivan@ivan-Presario-CQ43-Notebook-PC:~$

The idea is that
String : world3184
Is : 4

Any ideas why not return a numeric value?

Regards



2013/5/6 Regina Henschel <[email protected]>

> Hi Jorge,
>
>
> jorge ivan poot diaz schrieb:
>
>> thanks,
>>
>>
>> buf.charAt (nLen - 1): this variable has a string as '1' or '2', '3'...'9'
>> as it could change to int, any ideas, please help!
>>
>> I've done this:
>> int ty = buf.charAt(nLen - 1);
>> built well, but the result is not as expected.
>>
>
> You should post what you get and what you expect. But perhaps the
> following hints might already solve your problem.
>
> Have a look at stringToDouble in main/sal/rtl/source/math.cxx to learn
> about converting to number.
>
> Or
>
> charAt returns a sal_Unicode. Searching the definition for sal_unicode you
> come to main/sal/inc/sal/types.h with leads you to wchar_t. So search in
> internet for "wchar_t to int" to get an idea what to do.
>
> Kind regards
> Regina
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> dev-unsubscribe@openoffice.**apache.org<[email protected]>
> For additional commands, e-mail: [email protected]
>
>

Reply via email to