diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-21 10:53:24 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-03 20:24:25 -0500 |
commit | cf38d7f7a8fa4efd100cb368dc19c6472c4094a0 (patch) | |
tree | f82b8dcff58110ca66d69233d276fa00c70154a6 /basic | |
parent | 6a0698554cbe86b2763873e26e1fce65e6c2fa6d (diff) |
basic: implement RIGHT with OUString
Change-Id: Iff2150cf45569ca3d95f461495f49c455178cb5e
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 8c510e4eb1b0..0776831da8cd 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1350,22 +1350,19 @@ RTLFUNC(Right) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - const String& rStr = rPar.Get(1)->GetString(); - sal_Int32 lResultLen = rPar.Get(2)->GetLong(); - if( lResultLen > 0xffff ) - { - lResultLen = 0xffff; - } - else if( lResultLen < 0 ) + const OUString& rStr = rPar.Get(1)->GetOUString(); + int nResultLen = rPar.Get(2)->GetLong(); + if( nResultLen < 0 ) { - lResultLen = 0; + nResultLen = 0; StarBASIC::Error( SbERR_BAD_ARGUMENT ); } - sal_uInt16 nResultLen = (sal_uInt16)lResultLen; - sal_uInt16 nStrLen = rStr.Len(); + int nStrLen = rStr.getLength(); if ( nResultLen > nStrLen ) + { nResultLen = nStrLen; - String aResultStr = rStr.Copy( nStrLen-nResultLen ); + } + OUString aResultStr = rStr.copy( nStrLen - nResultLen ); rPar.Get(0)->PutString( aResultStr ); } } |