Post Reply 
Padding a string with spaces
03-03-2015, 10:40 PM (This post was last modified: 03-04-2015 04:22 AM by Mark Hardman.)
Post: #7
RE: Padding a string with spaces
(03-02-2015 07:20 AM)Joe Horn Wrote:  Here's an unexpected hidden feature. To pad a short string with spaces so that its total length is X characters, all it takes is:

REPLACE(string,X+1,"")

It looks like this can be used to generate a left padded string by swapping the arguments:

REPLACE("",X+1,string)

For example:

Code:

REPLACE("",10+1,"ABCDE") --> "          ABCDE"


ETD: This doesn't work as well as first though (see below).

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Padding a string with spaces - Joe Horn - 03-02-2015, 07:20 AM
RE: Padding a string with spaces - Angus - 03-03-2015, 08:02 AM
RE: Padding a string with spaces - Han - 03-03-2015, 05:08 PM
RE: Padding a string with spaces - Mark Hardman - 03-03-2015 10:40 PM
RE: Padding a string with spaces - Angus - 03-04-2015, 05:43 AM



User(s) browsing this thread: 1 Guest(s)