Blog Archive

RPGLE string manipulation - Delete a String using %replace() and %scan()

Click here if you are looking for Find and Replace 

 

%REPLACE returns the character string produced by inserting a replacement string into the source string, starting at the start position and replacing the specified number of characters.


%REPLACE(replacement string: source string{:start position {:source
length to replace}})

%SCAN returns the first position of the search argument in the source string, or 0 if it was not found. If the start position is specified, the search begins at the starting position. The result is always the position in the source string even if the starting position is specified. The starting position defaults to 1.


%SCAN(search argument : source string {: start})

Deleting a String

Delete is easy just insert and empty string !
 $pos = %scan(%trim($scan_data):$string_data);   
 $string_data = %replace( ''       
                   : $string_data                   
                   : $pos                           
                   : %len(%trim($scan_data)));   

1 comment :

  1. The blog or and best that is extremely useful to keep I can share the ideas of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    animal jam | five nights at freddy's | hotmail login

    ReplyDelete