Padding a string with spaces
|
03-02-2015, 07:20 AM
(This post was last modified: 03-02-2015 07:56 AM by Joe Horn.)
Post: #1
|
|||
|
|||
Padding a string with spaces
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,"") where "" is an empty string. If the input string is already X characters long (or longer), it is returned unchanged. Spaces are only appended if SIZE(string)<X. Examples: REPLACE("ABCDE",10+1,"") --> "ABCDE " (ten characters long) REPLACE("ABCDEFGHIJKL",10+1,") --> "ABCDEFGHIJKL" (unchanged) Warning: Ridiculously large values for X makes Prime unhappy. <0|ɸ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Padding a string with spaces - Joe Horn - 03-02-2015 07:20 AM
RE: Padding a string with spaces - bobkrohn - 03-03-2015, 07:32 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 - bobkrohn - 03-03-2015, 09:34 PM
RE: Padding a string with spaces - Mark Hardman - 03-03-2015, 10:37 PM
RE: Padding a string with spaces - Mark Hardman - 03-03-2015, 10:40 PM
RE: Padding a string with spaces - bobkrohn - 03-04-2015, 02:20 AM
RE: Padding a string with spaces - bobkrohn - 03-04-2015, 03:30 AM
RE: Padding a string with spaces - Mark Hardman - 03-04-2015, 04:09 AM
RE: Padding a string with spaces - bobkrohn - 03-04-2015, 06:11 AM
RE: Padding a string with spaces - Angus - 03-04-2015, 05:43 AM
RE: Padding a string with spaces - StephenG1CMZ - 10-07-2015, 10:02 PM
RE: Padding a string with spaces - bobkrohn - 10-09-2015, 07:58 AM
|
User(s) browsing this thread: 2 Guest(s)