Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display a particular character of a word

Former Member
0 Kudos

Hi,

can anyone tell me how to display a particular character of a word in smart forms,Ex:suppose word is India and i want to display character d..

Thanks in advance.

Rajesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

Pl find the attached code.

data: flag type i,

flag1 type i,

string(5) type c.

string = 'india'.

flag = 3. "position to print

flag1 = flag - 2.

write: / string+flag(1).

Thanks & Regards,

Krishna..

5 REPLIES 5

Former Member
0 Kudos

hi,

data country(10) type c.

country = 'India'.

country+2(1) will give 'd'

ie variable+offset(length)

Regards

Karthik D

Former Member
0 Kudos

please look at the below explanation:

DATA: VAR TYPE CHAR20.

VAR = 'INDIA'.

WRITE:/ VAR(3) - THIS WILL PRINT FIRST THREE CHARACTERS OF THE INDIA SO THE OUTPUT WILL BE : IND

WRITE:/ VAR+3(1) = THIS WILL PRINT 1ST CHARACTER AFTER FIRST 3 CHARACTERS SO THE OUTPUT WILL BE : I

COPY REQUIRED CHARACTERS IN ANOTHER VARIABLE.

DATA: VAR2 TYPE CHAR10.

VAR2 = VAR+3(2) .

former_member585060
Active Contributor
0 Kudos

Hi,

Country = 'India'.

P1 &COUNTRY+2(1)&

Output will be d

Other ex:-

symbol= 123456789.

&symbol(3)& -> 123

&symbol(7)& -> 1234567

&symbol+4(3)& -> 567

Regards

Bala Krishna

Edited by: Bala Krishna on Oct 17, 2008 12:22 PM

Former Member
0 Kudos

hi,

u can use offset to get the output.

data str type string.

data str2 type c.

str = 'INDIA'.

str2 = str+2(1)

now str2 will contain D.

Former Member
0 Kudos

Hi ,

Pl find the attached code.

data: flag type i,

flag1 type i,

string(5) type c.

string = 'india'.

flag = 3. "position to print

flag1 = flag - 2.

write: / string+flag(1).

Thanks & Regards,

Krishna..