함수 removeAt()

함수 removeAt()

1 Java[ | ]

ArrayList<String> fruits =  new ArrayList<String>();
fruits.add("apple");
fruits.add("banana");
fruits.add("cranberry"); 
fruits.add("orange"); 
fruits.remove(2);
System.out.println( fruits );
// [apple, banana, orange]

2 JavaScript[ | ]

var fruits = ['apple', 'banana', 'cranberry', 'orange'];
fruits.splice(2,1);
console.log( fruits );
// ["apple", "banana", "orange"]

3 PHP[ | ]

$fruits = ['apple', 'banana', 'cranberry', 'orange'];
array_splice( $fruits, 2, 1 );
print_r( $fruits );
# Array
# (
#     [0] => apple
#     [1] => banana
#     [2] => orange
# )
$fruits = ['apple', 'banana', 'cranberry', 'orange'];
unset( $fruits[2] );
print_r( $fruits );
# Array
# (
#     [0] => apple
#     [1] => banana
#     [3] => orange
# )

4 Perl[ | ]

my @fruits = ('apple', 'banana', 'cranberry', 'orange');
splice @fruits, 2, 1;
print @fruits;
# applebananaorange

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}