|
| 09 Jan 2013 06:39 PM |
| So, I'm searching through a string for a word, "Hello", for example. I want to find both places that the string is located, the beginning, and the end. I can get the beginning, but how can I get the end place? String.find return a number like so "beginning_number end_number", but how can I get the end number? |
|
|
| Report Abuse |
|
|
| 09 Jan 2013 06:41 PM |
If you mean what I think you mean, you could just do this:
beginning_number + #string
That's my guess. Not sure if I understood you though. |
|
|
| Report Abuse |
|
|
| 09 Jan 2013 06:46 PM |
| You can use -1 to represent the end, and -2 to mean the one just before the end, and so on. |
|
|
| Report Abuse |
|