Sign in to follow this  
Followers 0
hmsSurprise

String formatting

2 posts in this topic

I wish to print two strings, the first up to 70 characters and the 2nd 10 characters. I want the 2nd field to start in column 71 as it is a pass/fail column and therefore want it to be aligned. I tried the string format

$string = stringFormat("%-70s, %10s", $str, $str2)

This however sets the max length of the string field is does not pad it. Is there a formatting feature that can do this or do I need to pad my string with blanks?

Thanks,

jvh

Share this post


Link to post
Share on other sites



I fixed it with

$string = $str & _StringRepeat(' ', 80 - StringLen($str)) & $str2

jh

Share this post


Link to post
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
Sign in to follow this  
Followers 0