Typo commented on a Page, $coloring  -  Aug 27, 2008

This seams like overkill in way too many ways to mention. In just a couple minutes I came up with a one line alias to do almost the same thing.

Mine works like yours mostly except it requires both foreground and background colors.

I didnt think that was a big deal because your code and therefore my alternate code are only to be used as identifiers and its safe to assume that someone using an identifier can be trusted to include two colors.

My example is not trying to out do your code. Im simply trying to show you that theres differen ways of going about things that will help keep the size down.

Remember, mine works like $ColorIt(Color1,Color2,Text).bu such as $colorit(4,1,Hello people).ub

alias colorit { if ($isid) && ($1 isnum 0-15) && ($2 isnum 0-15) { return $iif(b isin $prop,) $+ $iif(u isin $prop,) $+  $+ $iif($1 isnum 0-9,0) $+ $round($1) $+ $chr(44) $+ $iif($2 isnum 0-9,0) $+ $round($2) $+ $3- } }

That code makes sure that the alias was called as an identifier and that both provided numbers are 0-15. It uses round to make sure that when it adds the 0 to the numbers 0-9 it woudnt end up with 009 for instance. It does some quick checks on $prop for the bold and underline and you end up with the text returned as wanted.

I hope this helps you with some ideas on how to improve your code.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.