JSI Tip 8153. How can I create a long blank string?


I have scripted blankString.bat to make it easier to create a long blank string.

The syntax for using blankString.bat is:

call blankString Size pad

Where Size is the length of the blank string you wish to create, and pad is a call directed environment variable that will contain the blank string.

blankString.bat contains:

@echo off
if \{%2\}==\{\} @echo Syntax: blankString Size pad&goto :EOF
setlocal
set /a size=%1
::                  1         2         3         4         5         6         7         8         9
::         1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
set pad100=                                                                                                    #
set pad100=%pad100:~0,100%
set pad=%pad100%
set /a num=%size%/100
for /l %%p in (1,1,%num%) do (
 call :padit
)
call set wrk=%%pad:~0,^%size%%%
endlocal&set %2=%wrk%
goto :EOF
:padit
set pad=%pad% %pad100%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish