Default Length for string

Hi am trying to concat two string, which is working fine,

I need a help to set a default length for the string.

Eg:

If i Concat “1234”& “123”, am getting a result as “1234123”,
my expected output is “12341 23”. the 1st string should have a length of 10, if the string length is lesser than that is should replaced with space, is it possible?

@Manikandasamy

Try this.

   inputStr = "12345"

Here, inputStr length is 5 right. So we have to add 5 spaces as you mentioned.

        newStr = inputStr.PadRight(10-inputStr.Length)

Thank @lakshman :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.