You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by jorge ivan poot diaz <iv...@gmail.com> on 2013/05/06 14:57:38 UTC

Re: OUStringBuffer

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.

regards!


2013/4/29 Herbert Dürr <hd...@apache.org>

> Hi Jorge,
>
> like Regina I have a hard time to understand the question. My best guess
> is that you have an OUStringBuffer object and need an UniString (aka tool's
> String [1]). If that is so you can get it using the UniString constructor
> that takes an OUString argument:
>
>    UniString( buf.makeStringAndClear() )
>
> [1] http://opengrok.adfinis-**sygroup.org/source/xref/aoo-**
> trunk/main/tools/inc/tools/**solar.h#269<http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/tools/inc/tools/solar.h#269>
>
> Hope that helps,
> Herbert
>
>
> On 2013/04/25 8:00 PM, jorge ivan poot diaz wrote:
>
>> I've already made a concatenation, in this file:
>> http://opengrok.adfinis-**sygroup.org/source/xref/aoo-**
>> trunk/main/cui/source/**tabpages/tpcolor.cxx#546<http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/cui/source/tabpages/tpcolor.cxx#546>
>>
>>
>> Something like this:
>>
>> OUStringBuffer buf( 128 );
>> buf.append( aName );
>> buf.append( 4 );
>> OUString string = buf.makeStringAndClear();
>> OString oString = rtl::OUStringToOString( string ,
>> RTL_TEXTENCODING_ASCII_US );
>>
>> Substituting aName by oString in this fragment of code
>> http://opengrok.adfinis-**sygroup.org/source/xref/aoo-**
>> trunk/main/cui/source/**tabpages/tpcolor.cxx#549<http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/cui/source/tabpages/tpcolor.cxx#549>
>> ,
>> I have the following error,
>>
>> http://ooo.pastebin.ca/2366521
>>
>> So, I want to convert this code to a STRING:
>> OString oString = rtl::OUStringToOString( string ,
>> RTL_TEXTENCODING_ASCII_US );
>>
>> Because the definition of aName is STRING, as you can see here:
>> http://ooo.pastebin.ca/2366523
>>
>> The file is located at:
>> http://opengrok.adfinis-**sygroup.org/source/xref/aoo-**
>> trunk/main/svx/inc/svx/xtable.**hxx#57<http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/svx/inc/svx/xtable.hxx#57>
>>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@openoffice.**apache.org<de...@openoffice.apache.org>
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>

Re: OUStringBuffer

Posted by Regina Henschel <rb...@t-online.de>.
Hi,

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

??? We are in C++ not in Java.

Kind regards
Regina

>
>
> On Tue, May 7, 2013 at 9:56 PM, jorge ivan poot diaz <
> ivan.pootdiaz@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...@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-unsubscribe@openoffice.apache.org>
>>> For additional commands, e-mail: dev-help@openoffice.apache.org
>>>
>>>
>>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Re: OUStringBuffer

Posted by rahul bhola <rb...@gmail.com>.
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.pootdiaz@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...@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-unsubscribe@openoffice.apache.org>
> > For additional commands, e-mail: dev-help@openoffice.apache.org
> >
> >
>



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

Re: OUStringBuffer

Posted by rahul bhola <rb...@gmail.com>.
sorry was working with openmeetings and that is in java



On Wed, May 8, 2013 at 4:42 AM, Regina Henschel <rb...@t-online.de>wrote:

> Hi Jorge,
>
> jorge ivan poot diaz schrieb:
>
>> 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);
>>
>
> I do not meant, that you should call stringToDouble. I meant, that you
> should look into the implementation of that method to see how the
> conversion from character to digit is done there.
>
> Are you sure that the line
>
>         String abuf = buf.charAt(nLen - 1);
> really does, what you think that it does?
>
> Kind regards
> Regina
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: dev-unsubscribe@openoffice.**apache.org<de...@openoffice.apache.org>
>
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>


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

Re: OUStringBuffer

Posted by Regina Henschel <rb...@t-online.de>.
Hi Jorge,

jorge ivan poot diaz schrieb:
> 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);

I do not meant, that you should call stringToDouble. I meant, that you 
should look into the implementation of that method to see how the 
conversion from character to digit is done there.

Are you sure that the line
	String abuf = buf.charAt(nLen - 1);
really does, what you think that it does?

Kind regards
Regina


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Re: OUStringBuffer

Posted by jorge ivan poot diaz <iv...@gmail.com>.
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...@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<de...@openoffice.apache.org>
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>

Re: OUStringBuffer

Posted by Regina Henschel <rb...@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
For additional commands, e-mail: dev-help@openoffice.apache.org