Hi,
Chris Sherlock <[email protected]> writes:
> But if you do the following:
>
> aCreationMetaDateString.append(char('0' + ((aDT.Year / 1000) % 10))
> + char('0' + ((aDT.Year / 100) % 10))
> + char('0' + ((aDT.Year / 10) % 10))
> + char('0' + ((aDT.Year) % 10)));
>
> Then the compiler thinks the char needs numeric addition, and doesn’t invoke
> the + operator.
>
> How does one get around this? Note this only happens with char.
I ran into the same problem. I think you can solve it by replacing
“char” with OUStringChar like this:
aCreationMetaDateString.append(OUStringChar('0' + ((aDT.Year / 1000) % 10))
+ OUStringChar('0' + ((aDT.Year / 100) % 10))
+ OUStringChar('0' + ((aDT.Year / 10) % 10))
+ OUStringChar('0' + ((aDT.Year) % 10)));
It looks like there is a bunch of templating magic so that it doesn’t
create a temporary buffer to do the concatenation before handing it to
the append method.
I’m kind of new to this so I don’t know if there’s a better way to do
it. I stumbled across this documentation but it doesn’t explain very
much. If that is the only documentation then maybe it needs some work.
https://wiki.documentfoundation.org/Development/String_Classes
Regards,
– Neil