Hello,
is there any function to create a string with a lot of copies of a specific character? For example:
copy("A", 5) --> "AAAAA"
Thank you!
How to create a string like "====================="
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Ale,
try
tCollect is now ->"AAAAA"
regards
Bernd
try
Code: Select all
repeat 5
put "A" after tCollect
end repeat
regards
Bernd
Hi ale870,
no there is no other way to do this!
But you can save some typing by simply writing:
Best
Klaus
no there is no other way to do this!
But you can save some typing by simply writing:
Code: Select all
...
repeat 5
put "x" after my_string_with_x
end repeat
...
Best
Klaus
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
The thing is to build up your collection of such functions in a library, so you only have to write them once.
This means that you need to generalise them:
Best,
Mark Smith
This means that you need to generalise them:
Code: Select all
function stringRep pString, pNumReps
put empty into tRepString
repeat pNumReps
put pString after tRepString
end repeat
return tRepString
end stringRep
Mark Smith