It is currently Thu Sep 19, 2019 3:23 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Lset and Rset function or documentation problem
PostPosted: Tue Sep 10, 2019 12:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:17 pm
Posts: 297
Location: United Kingdom
The following code:
Code:
Define.S Str, Lft, Rgt
Str = "LongString"
Lft = LSet(Str, 4)
Rgt = RSet(Str, 4)
Debug Str
Debug Lft
Debug Rgt

Yields:
Code:
LongString
Long
Long

However the documentation implies that a difference would be expected between the Lset and Rset output in this case:
Help/Lset wrote:
If the string is longer than the specified length, it will be truncated starting from the left side of the string.

Help/Rset wrote:
If the string is longer than the specified length, it will be truncated starting from the right side of the string.

One of the functions or the documentation is buggy...
(Kudos to 'nsstudios' for the original bug find).


Top
 Profile  
Reply with quote  
 Post subject: Re: Lset and Rset function or documentation problem
PostPosted: Tue Sep 10, 2019 2:24 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1650
Agreed. Looks like a bug with RSet() when Length param < String length.

It should preserve the right side of the string, but it preserves the left side (like LSet).

Code:
Str.s = "1234567890"
For i = 15 To 1 Step -1
  Debug LSet(Str, i, "_")
Next i

Debug ""
For i = 15 To 1 Step -1
  Debug RSet(Str, i, "_")
Next i

_________________
On GitHub: PB Includes - IDE Tools - Color Themes


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye