String to array

string to array
string splits by every character
str_split()

1 Java[편집]

16px-Crystal_Clear_app_xmag.svg.png 자바 String to array 문서를 참고하십시오.
public class MyClass {
    public static void main(String args[]) {
        String str = "ABC안녕123★";
        char[] chs = str.toCharArray();
        for(int i=0; i<chs.length; i++) System.out.printf("%c, ",chs[i]);
        // A, B, C, 안, 녕, 1, 2, 3, ★, 
    }
}

2 JavaScript[편집]

var chars = 'ABC안녕123★'.split('');
console.log( chars );
// ["A", "B", "C", "안", "녕", "1", "2", "3", "★"]

3 Perl[편집]

use utf8;
@query=split '', 'ABC안녕123★';
print "$_, " for @query;
# A, B, C, 안, 녕, 1, 2, 3, ★,

4 PHP[편집]

16px-Crystal_Clear_app_xmag.svg.png PHP str_split() 문서를 참고하십시오.
<?php
function mb_str_split( $str ) { 
	return preg_split('/(?<!^)(?!$)/u', $str ); 
} 
$str = 'ABC안녕123★';
$chs = mb_str_split($str);
foreach($chs as $ch) echo "$ch, ";
# A, B, C, 안, 녕, 1, 2, 3, ★,

5 같이 보기[편집]

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