Bixby Sayz
2012-04-03 22:13:15
My pascal is a bit rusty. I recall being able to do this in Delphi but I'll be damned if I can remember how.
Looking to generate a string that is x number of a character. For example 10 -'s (———-).
For some reason thought I could do it with the Format function but can't seem to get it going. (Perhaps I am confusing with C's sprintf command?)
Any thoughts?
Kyle Undefined
2012-04-03 23:42:40
You mean the Pad methods?
function Replicate(c: Char; I : LongInt) : string;
Example:
Writeln(Replicate('-', 10));
=>
----------
m34tcode
2012-04-04 01:47:34
You are looking for pad.
Padl, Padr, and Padz will make the string a given length, and put them on the side. Padl, adds to left, Padr to right, and z evens them out I believe
From: m34tcode
You are looking for pad.
Padl, Padr, and Padz will make the string a given length, and put them on the side. Padl, adds to left, Padr to right, and z evens them out I believe
No, he is not looking for the padding functions, he is looking for replicate from the looks of his post.
m34tcode
2012-04-04 07:46:52
Sounded like he meant that instead of format but idk. Either way he knows both now ;)
Bixby Sayz
2012-04-04 09:35:17
I use pad all the time already. Sex was correct I was looking for the replicate function.
Haven't done any serious programming in 10+ yrs and find myself trying to use a C+ Builder function in Simba, or looking for a Delphi function that doesn't exist in Simba, or…
Figured it would be faster to simply ask on here. Thanks guys.
m34tcode
2012-04-04 09:38:06
Glad u got what u need :)