Tags

, , , , , , ,

Let’s assume that we have defined two strings as

str1 = 'abc'

str2 = 'pqr'

and an  integer

integ = 25

(Make sure str1 and str2, and integ are defined as character strings, and integer, respectively)

1. Concatenate str1 and str2 into str3 (make sure you define str3 first as a character string)

str3 = str1//str2

2. Concatenate str1 and integ into str3 (again make sure str3 is defined as a character string)

step a: convert integer to a string first (make sure str4 is defined as a character string and not initialized, i.e. it’s so far an empty string)

write(str4,'(I5)') integ

step b: concatenate str1 and str4 into str3

str3 = str1//str4

Advertisements