ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 20 Jun 2013 05:31 PM |
D = "18/8/2007"
Dfix = string.gsub(Date, "8", "08", 1)
I only want it to sub the 2nd 8, how do i do that? |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
| |
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
|
| 20 Jun 2013 05:46 PM |
| Dfix = string.gsub(Date, "8", "08", 3) |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 20 Jun 2013 05:47 PM |
it no work like that
the last number is the amount of times it replaces 8 with 08 |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 20 Jun 2013 05:47 PM |
| Excuse if I am wrong, but I believe you need to change your variable name. Just change "D" to "Date". The variables don't match, therefore it won't enter in "18/8/2007". |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 20 Jun 2013 05:53 PM |
oops I changed that just before I posted it
in actual script they match
|
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 20 Jun 2013 05:55 PM |
D = "18/8/2007"
Dfix = string.gsub(D, "/8", "/08", 1)
durr hurr hurr |
|
|
| Report Abuse |
|
|