What is the C/SIDE equalivent for the VB6 String() function?
This function takes 2 arguments:
Function String(Number As Long, Character) As String
The return value is a string of characters specified by the Character argument, repeated Number times.
String(4, "O") returns "OOOO".
String(4, 65) returns "AAAA".
0
Comments
RIS Plus, LLC
xtest text 30
The command
xtest := PADSTR('',5,'Q');
will give you a string of 'QQQQQ'
The command
xtest := padstr(xtest,maxstrlen(xtest),'m');
will pad out the existing contents of xtest with m's. If it were applied right after the previous command, the result would be
'QQQQQmmmmmmmmmmmmmmmmmmmmmmmmm'
If that were followed by the command
xtest := PADSTR('',7,'P');
the result would be 'PPPPPPP'
Co-Founder Liberty Grove Software
Author: Programming Microsoft Dynamics NAV (V5.0), 2009, 2013
Then in the trigger, you enter a local integer variable called Index, and you write the following code:
Of course you should also program some safeguards in it to check for maximum length and stuff like that, to prevent overruns.
Now you can call this function from anywhere in Navision. All you need to do is declare the codeunit in your variables and call the RepeatString function with the values you specify.
RIS Plus, LLC
RIS Plus, LLC
this is my version of PADSTR left.
I found this thread after I finished my code.
My code doesn't have no WHILE statement.
And it also truncate the string if ln_len is smaller then lc_str (same as PADSTR)
Phil :P
>>>>>>>>>>>>
PADL(lc_str : Text[255];ln_Len : Integer;lc_padChar : Text[1]) : Text[255]
IF ln_Len > 255 THEN
ERROR('Max length is 255');
lc_str2 := COPYSTR(lc_str,1,ln_Len);
lc_str1 := PADSTR('',ln_Len-STRLEN(lc_str2),lc_padChar);
EXIT(lc_str1 + lc_str2);