hi,
i have a problem and i wnat to know if someone can help me
i have a string, for example: 'sadadas 132 asdad 8/32'
and i want to get the first numbers.
This (132)
what is the better option to do this?
with STRPOS for detect the first number in the string and then find the first blank space?
how can i do this? thanks!
0
Comments
If there is always a space before and after the numbers, you could get always one part of the string (from start - first space, or from space to space) and try to use EVALUATE to determine if it is a number. if it is, exit the loop or function with the result. The sample below is just one way of doing it. "string" is a text variable, "pos" and "pos2" are integer, and "result" is decimal.
If the numbers could be anywhere in the string, you would have to start looking at each character in a string and if the character is a number, you add it to your result and keep on doing that until you hit a non-number. The sample below is another way of doing this. "string" and "result" are text variables, "pos" is integer, "IsNumeric" is boolean.
NAV Practice Manager at Clients First Business Solutions
Did you check out our free training videos at www.dynamics-nav-training.com?
Look at our blogs.
Adjust as necessary for decimal format with punctuation.
Pacific City, OR