mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Utils.String.RemoveAt
would incorrectly calculate the slice index if it was > 0. It will now remove the correctly specified character.
This commit is contained in:
parent
773dc8a2b9
commit
eb7f17c387
1 changed files with 4 additions and 2 deletions
|
@ -7,11 +7,13 @@
|
|||
/**
|
||||
* Takes a string and removes the character at the given index.
|
||||
*
|
||||
* The index is zero based.
|
||||
*
|
||||
* @function Phaser.Utils.String.RemoveAt
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {string} string - The string to be worked on.
|
||||
* @param {number} index - The index of the character to be removed.
|
||||
* @param {number} index - The index of the character to be removed. This value is zero-based.
|
||||
*
|
||||
* @return {string} The modified string.
|
||||
*/
|
||||
|
@ -23,7 +25,7 @@ var RemoveAt = function (string, index)
|
|||
}
|
||||
else
|
||||
{
|
||||
return string.slice(0, index - 1) + string.slice(index);
|
||||
return string.slice(0, index) + string.slice(index + 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue