Jump to content

Fullfill a string


Recommended Posts

Hi Guys,

is there a function to fullfill a string?

I want to write a line into a file and the arguments to write have got different length. So the output looks not very good. If I had a function that makes all the arguments the same length maybe fill in some spaces untill the length is reached, my Problem would be solved B)

File --> I want the X like a row down.

Access IBM Tools X4.0 XIBM Corporation XC:\Programme\IBM\Access IBM\IBMUINST.EXE

ActivePerl 515 X X X"\\filesrv01\prg\OS\NT\DDS\USER\SETUP.EXE" "\\filesrv01\prg\OS\NT\DDS\dds_seu\pakete\Active State\perl\5.15\install\Setup.inf" /X4

X X X

Acrobat Reader 7.0 X X X"C:\Programme\Gemeinsame Dateien\Setup32\Setup.exe" "C:\Programme\Adobe\Install\Setup.inf" /X4

AFPL Ghostscript 8.13 X X XC:\Programme\GS\uninstgs.exe "C:\Programme\GS\gs8.13\uninstal.txt"

AFPL Ghostscript Fonts X X XC:\Programme\GS\uninstgs.exe "C:\Programme\GS\fonts\uninstal.txt"

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

If I understood you right, I think you want to make all the strings a certain character length?

Try this:

$Max=100; number of characters for the max
$char='X'; the char you want to tack on to the string
For $x=StringLen($Str) To $Max
    $Str=$Str&$char
Next

EDIT: Thought of another way:

$Max=100; number of characters for the max
$char='X'; the char you want to tack on to the string
While 1
If StringLen($Str) < $Max Then
$Str=$Str&$char
ContinueLoop
EndIf
ExitLoop
WEnd
Edited by Andrew Sparkes

---Sparkes.

Link to comment
Share on other sites

Hi,

thanks it works. B) Sometimes the solution seems to be so easy, but ... :">

So long,

Mega

P.S.: Maybe it should be a function in autoit to do something like that. :-)

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

I did something like that out of your source -->

Func _fullfill($maxLength, $string, $fullFillChar)

; $maxLength = maximum string size

; $fullFillChar = char to fullfill the string

While 1

If StringLen($string) < $maxLength Then

$string = $string & $fullFillChar

ContinueLoop

EndIf

ExitLoop

WEnd

Return $string

EndFunc

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...