sponsored links

Collapse

Announcement

Collapse
No announcement yet.

How to use %scanrpl

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use %scanrpl

    Hope somebody can help me. I tried to use %scanrpl like this
    Code:
    dcl - s var      char(10);
    dcl - s result char(10); 
    val = 'Hello';
    result = 'Hello World'
    result = %scanrpl(val:'':result);
    The result still show as 'Hello World' instead of ' World'. If I just do result = %scanrpl('Hello':'':result); the result show as ' World'. Why, is there something I did wrong? if not, is there any other method to use? My progame aim is to delete strings in the message but those string can be variable.

  • #2
    You're looking for 'Hello ', which isn't there. var is a fixed-length string, so it has trailing blanks. Try changing the definition to be varChar(10).

    Comment


    • lxb0007
      lxb0007 commented
      Editing a comment
      Thank you!

  • #3
    Code:
    'Hello     '
    It removed the blanks from my prior post.

    Comment


    • lxb0007
      lxb0007 commented
      Editing a comment
      I tried, and it works! Appreciate it.
Working...
X