I know if/else works, but I needed an alternative.
I am using
B = String.Concat(A.Substring(0, 40));
to capture the first 40 characters of a value.
If the value at A is more than 40, B is able to capture, but if the value of A is less than 40, there is no value being captured at B.
String.Concat does not serve your purpose here. You should rather do the following: