Pot.Struct.removeAt

{*} Pot.Struct.removeAt ({*} object, {Number} index [, {Number} length = 1])

Pot.js で利用可能。 PotLite.js では利用できません。

object のうち指定した位置から長さまで削除して返します。

引数 object のうち、引数 index から 引数 length まで削除したコピーが返ります。
length を省略すると 長さ 1 だけ削除されます。

Pot.globalize() が適応されている場合、Pot.removeAt() が removeAt() で実行できます。

index から length の長さまで削除された object のコピーが返ります。

// String
Pot.debug(Pot.removeAt('foo bar baz', 2));         // 'fo bar baz'
Pot.debug(Pot.removeAt('foo bar baz', 2, 5));      // 'fo baz'
Pot.debug(Pot.removeAt('foo bar baz', 100));       // 'foo bar baz'

// Array
Pot.debug(Pot.removeAt([1, 2, 3, 4, 5], 2));       // [1, 2, 4, 5]
Pot.debug(Pot.removeAt([1, 2, 3, 4, 5], 2, 2));    // [1, 2, 5]
Pot.debug(Pot.removeAt([1, 2, 3, 4, 5], -1, 5));   // [1, 2, 3, 4]

// Object
Pot.debug(Pot.removeAt({A: 1, B: 2, C: 3}, 2));    // {A: 1, B: 2}
Pot.debug(Pot.removeAt({A: 1, B: 2, C: 3}, 1, 5)); // {A: 1}
Pot.debug(Pot.removeAt({A: 1, B: 2, C: 3}, 5));    // {A: 1, B: 2, C: 3}

// Number
Pot.debug(Pot.removeAt(1234512345, 2));            // 123451245
Pot.debug(Pot.removeAt(1234512345, 2, 3));         // 1234545
Pot.debug(Pot.removeAt(-1234512345, 2, 3));        // -1234545