Padding a string with spaces
|
10-07-2015, 10:02 PM
(This post was last modified: 10-07-2015 10:09 PM by StephenG1CMZ.)
Post: #13
|
|||
|
|||
RE: Padding a string with spaces
I decided to have a go at this, based on the original syntax.
My changes include: An input guard against negative/fractional parameters. The input string is not modified. In the centre case, a recursive call is used which I think makes the logic clearer, and avoids repeatedly adding spaces one by one. My implementation is probably less efficient, but provides a comparison for the previous logic. Code:
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« 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: 1 Guest(s)