How to right align a string in 4gl with specified no.of spaces?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the FILL function to create a specified number of spaces. For example, FILL(“A”, 10) will return “AAAAAAAAAA”.
Here’s is a simple demo:
Your required overall length is 16 characters. Use LENGTH(cText) to determine how many characters your text takes up, and then use FILL to create the remaining number of spaces at the front of the string.
Informix
I answered this question for Progress 4GL, and only noticed afterwards that the question was asked about Informix 4GL. I am very sorry for my mistake.
You can use the same principal to do this in Informix. You use the LENGTH keyword to find out how long your existing text is, but instead of using FILL() to pad it with spaces, you should use SPACES.
I really hope this helps you.