10-28-2009 04:37 AM
Hi,
This should be simple, but I can't figure out a good conversion methout "rube-goldberging" my code.
As I have tried to demonstrate above I am trying to get numbers from the end of a string.
1) The string can be any length, and contain any characters.
2) There can be any amount of other numbers in the string, these are not of interest.
3) There will always be atleast one "normal" character inforont of the number I want.
I have a feeling the scan from string function will do what I want, but I can't figure out the right format string I should use as a input...
Anyone here have any good ideas?
Solved! Go to Solution.
10-28-2009 04:50 AM
Hi
what i have understood is, that you want the Numbers which are at the end of the string.
Is this what you want (see attached)
10-28-2009 05:05 AM
Yes, something like that is what I want, too bad it does not work 😉
Your code assumes that there is always one "number character" at the end of the string with known length, but both the amount of "number characters" and the length of my string is unkown...
10-28-2009 05:17 AM
10-28-2009 05:21 AM
10-28-2009 05:21 AM - edited 10-28-2009 05:25 AM
10-28-2009 05:25 AM - edited 10-28-2009 05:26 AM
Regular expressions are your friend:
Use [0-9]+$ as the regular expression. The dollar sign ($) will look for the match only if it are the last characters of the string.
Ton
10-28-2009 05:26 AM
Assuming that you have purely the digits 0-9 at the end of string, you can pre-process the strinh with "match pattern" using regular expression "[0-9]*$". This will match any number of characters chosen from the range 0 to 9 at the end of the string.
The match substring output is the number, so decimal string to number will then get the number into an integer.
Rod.
04-26-2011 03:01 PM
thank you, i tried so much to know string to dbl.
now i got.
11-17-2011 04:14 AM
can i convert dbl again to the string after inserting dbl in to an array.