Parameters for LSet(), RSet() , etc.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Parameters for LSet(), RSet() , etc.

Post by Psychophanta »

Since there exist the format of simple quote like 'A' to refer an ascii value, functions that accepts a unique character as parameter (like LSet() for example) would more sense that it has the ascii value input instead of a string with maximum one character.
Thus, format for these sort of functions would be (in the LSet() as example):
Result$ = LSet(String$, Length [, Character])
instead of
Result$ = LSet(String$, Length [, Character$])
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

But it's a string function so it makes more sense the way it is.

If you want to pad a string with letter A's you wouldn't write

a$=rset("hello",20,65)
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

and what if for some reason u needed/wanted to use a unicode character in the padding?
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Derek wrote:a$=rset("hello",20,65)
lexvictory wrote:and what if for some reason u needed/wanted to use a unicode character in the padding?
Well, you would write:

Code: Select all

a$=rset("hello",20,'A')
also for unicode. I don't see any problem, but i see it more elegant.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I see your point, it's just that if you have to start remembering single quotes for some commands and double quotes for others then you may start to get more errors than usual. (I get enough errors as it is!)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

using the Chr()-funktion should be not that bad,
because it' not a funktion-call but an implemented macro (I think)

if you discover that it's not performant enough in loops,
you could use some

Code: Select all

in$ = Chr('A')
before the loop...

in the end it's just a matter of taste...
oh... and have a nice day.
Post Reply