|
| 01 Nov 2015 11:22 PM |
| So lets say I have this string "Agility - 47" how would I find the 47 part without knowing its 47? |
|
|
| Report Abuse |
|
|
PvN
|
  |
| Joined: 10 Apr 2010 |
| Total Posts: 22145 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Nov 2015 11:24 PM |
The easiest way: print(str:match("%d+")) -- get first occurrence of 1 or more consecutive digits or print(str:match("%S+$")) -- get anything up until a space from the end of the string |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2015 11:29 PM |
@PvN get off the forums if your not here to actually help @cnt thanks |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 01 Nov 2015 11:30 PM |
@cnt
I've been through the string pattern part of the wiki but I've never saw the $, explain.
Online Dogeing since 1337 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Nov 2015 11:31 PM |
| It just starts matching from the end of the string. |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 01 Nov 2015 11:34 PM |
So literally its the final value? If so thank you
Online Dogeing since 1337 |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 01 Nov 2015 11:35 PM |
Final as in after something
Online Dogeing since 1337 |
|
|
| Report Abuse |
|
|