Application Development and Automation 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: 
Read only

finding gap in input

Former Member
0 Likes
449

Lets say user inputs 0.123 0.456

How can I find out if the input field has a gap or space in it.

I tried

FIND ' ' in input

but this gives out subrc = 0 even when there is no space. Any ideas.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
382

Hi,

use this code... its tested and is working fine....

parameters input(10) type c.

data w_rc type i.

perform check_space using input changing w_rc.
if w_rc = 1.
  write 'Space available'.
else.
  write 'No Space'.
endif.

form check_space using value(p_input) like input changing p_rc.
  data : lw_index type i value 0.
  while p_input+lw_index <> ' '.
    if p_input+lw_index(1) = ' '.
      p_rc = 1.
      exit.
    endif.
    add 1 to lw_index.
  endwhile.
endform.

Regards,

Siddarth

2 REPLIES 2
Read only

Former Member
0 Likes
382
find regex [ [:space:] ] in input.

you have to use regex. ->regular expression. put F1 on it for more help

Read only

Former Member
0 Likes
383

Hi,

use this code... its tested and is working fine....

parameters input(10) type c.

data w_rc type i.

perform check_space using input changing w_rc.
if w_rc = 1.
  write 'Space available'.
else.
  write 'No Space'.
endif.

form check_space using value(p_input) like input changing p_rc.
  data : lw_index type i value 0.
  while p_input+lw_index <> ' '.
    if p_input+lw_index(1) = ' '.
      p_rc = 1.
      exit.
    endif.
    add 1 to lw_index.
  endwhile.
endform.

Regards,

Siddarth