RE: How to word wrap in batch 03-30-2013, 10:45 PM
#11
One way you could get words is like this:
I also once created a function to call that would count the number of chars in a variable. Combine that with this and you would have something that works with a bit of tweaking.
Code:
@echo off & setlocal enabledelayedexpansion
set s="this. is, a bunch! of words"
call :GetWords 4 %s%
echo !text!
pause > nul & goto :eof
:GetWords
set text=
for /l %%G in (1,1,%1) do (
call :GetWordAtIndex %%G %2
)
goto :eof
:GetWordAtIndex
for /f "tokens=%1" %%H in (%2) do ( set text=!text!%%H )
I also once created a function to call that would count the number of chars in a variable. Combine that with this and you would have something that works with a bit of tweaking.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]