take a substring that contains only the last letter and then use
Integer.parseInt() to convert it into integer


On Tue, May 7, 2013 at 9:56 PM, jorge ivan poot diaz <
ivan.pootd...@gmail.com> wrote:

> 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 <rb.hensc...@t-online.de>
>
> > 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<
> dev-unsubscr...@openoffice.apache.org>
> > For additional commands, e-mail: dev-h...@openoffice.apache.org
> >
> >
>



-- 
Rahul Bhola
B.E.
computers
Core Member
Department of backstage
Bits Pilani KK Birla Goa Campus

Reply via email to