Use the string functions strlen and substring?
But from your example, it looks like you're wanting to get numbers to 2 decimal places, and your preferred solution is to drop the last 3 characters. Perhaps you should do something like
DATA number TYPE P LENGTH 8 DECIMALS 2. number = string_representation_of_number.
It's usually a good idea to provide context with questions - what is the wider problem you're trying to resolve. While string slicing (or regex) might give you the answer, there may be a better way.
You can do that with a regular expression.
Create one that matches any number of characters followed by exactly three characters followed by the end of the word. Define the three characters as a group and replace that with an empty string.
Read the documentation to find out the syntax and use program DEMO_REGEX_TOY to experiment.
Add comment