File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * @author Richard Davey <rich@photonstorm.com>
3+ * @copyright 2020 Photon Storm Ltd.
4+ * @license {@link https://opensource.org/licenses/MIT|MIT License }
5+ */
6+
7+ /**
8+ * Takes a string and removes the character at the given index.
9+ *
10+ * @function Phaser.Utils.String.RemoveAt
11+ * @since 3.50.0
12+ *
13+ * @param {string } string - The string to be worked on.
14+ * @param {number } index - The index of the character to be removed.
15+ *
16+ * @return {string } The modified string.
17+ */
18+ var RemoveAt = function ( string , index )
19+ {
20+ if ( index === 0 )
21+ {
22+ return string . slice ( 1 ) ;
23+ }
24+ else
25+ {
26+ return string . slice ( 0 , index - 1 ) + string . slice ( index ) ;
27+ }
28+ } ;
29+
30+ module . exports = RemoveAt ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ module.exports = {
1212
1313 Format : require ( './Format' ) ,
1414 Pad : require ( './Pad' ) ,
15+ RemoveAt : require ( './RemoveAt' ) ,
1516 Reverse : require ( './Reverse' ) ,
1617 UppercaseFirst : require ( './UppercaseFirst' ) ,
1718 UUID : require ( './UUID' )
You can’t perform that action at this time.
0 commit comments