Post Reply 
Bug or Not? Taking STRING of a string whilst making leading zeros
01-30-2018, 11:38 AM
Post: #3
RE: Bug or Not? Taking STRING of a string whilst making leading zeros
(01-29-2018 04:41 PM)StephenG1CMZ Wrote:  Why aren't "9" and STRING("9") both of length 1, yielding 1 leading zero in the example code?
"9" is a string of length 1, but STRING("9") is a string of length 3: '9' plus 2 double quote characters.

(01-29-2018 04:41 PM)StephenG1CMZ Wrote:  Is there a better way to get leading zeros in a string?
A simple way to get a string with N zeros: tail(STRING(10^N)), or if you prefer not to use a CAS function: MID(STRING(10^N),2,N).
It works for N>=0, returning "" for N=0.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Bug or Not? Taking STRING of a string whilst making leading zeros - Didier Lachieze - 01-30-2018 11:38 AM



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