forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveAt.js
More file actions
30 lines (28 loc) · 706 Bytes
/
Copy pathRemoveAt.js
File metadata and controls
30 lines (28 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Takes a string and removes the character at the given index.
*
* @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.
*
* @return {string} The modified string.
*/
var RemoveAt = function (string, index)
{
if (index === 0)
{
return string.slice(1);
}
else
{
return string.slice(0, index - 1) + string.slice(index);
}
};
module.exports = RemoveAt;