0
How to get last numbers in a string. If numbers aren’t allows one or two digits.
250-HP-1403-CCT1. Needing 1 250-HP-1403-CCT10. Needing 10
5 Antworten
+ 4
Please specify the programming language and use the tags appropriately. And show us what you've done so far.
To get the Last Number on a String:
You can first reverse the string then use 'for loop' to iterate then if the next character is not a number then break the loop then reverse again the output number.
Or you can use regex and find the group of numbers then get the last number.
+ 2
//python
print(int(str[::-1]))
//ruby
puts str.reverse.to_i
0
i feel im wasting peoples time with my entry level qeustions. im such a rookie.
whats the purpose of the tag number.?
0
ohh and its SQL..
0
Right([SerialNumber],InStr(1,[SerialNumber],"CCT")-1