g
This commit is contained in:
parent
34f6bad788
commit
c1a45f7d02
@ -288,31 +288,31 @@ import { useRoute } from 'vue-router';
|
||||
|
||||
};
|
||||
|
||||
//초성 /알파벳 변환
|
||||
const getFirstCharacter = (char) => {
|
||||
const CHOSUNG_LIST = [
|
||||
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ',
|
||||
'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
|
||||
];
|
||||
//초성 /알파벳 변환
|
||||
const getFirstCharacter = (char) => {
|
||||
const CHOSUNG_LIST = [
|
||||
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ',
|
||||
'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
|
||||
];
|
||||
|
||||
if (!char || char.length === 0) return '';
|
||||
if (!char || char.length === 0) return '';
|
||||
|
||||
const code = char.charCodeAt(0);
|
||||
const code = char.charCodeAt(0);
|
||||
|
||||
// 한글 범위 (가~힣) → 초성 변환
|
||||
if (code >= 0xAC00 && code <= 0xD7A3) {
|
||||
const index = Math.floor((code - 0xAC00) / (21 * 28));
|
||||
return CHOSUNG_LIST[index];
|
||||
}
|
||||
// 한글 범위 (가~힣) → 초성 변환
|
||||
if (code >= 0xAC00 && code <= 0xD7A3) {
|
||||
const index = Math.floor((code - 0xAC00) / (21 * 28));
|
||||
return CHOSUNG_LIST[index];
|
||||
}
|
||||
|
||||
// 영어 소문자 → 대문자로 변환
|
||||
if (char.match(/[a-zA-Z]/)) {
|
||||
return char.toLowerCase();
|
||||
}
|
||||
// 영어 소문자 → 대문자로 변환
|
||||
if (char.match(/[a-zA-Z]/)) {
|
||||
return char.toLowerCase();
|
||||
}
|
||||
|
||||
// 기타 문자 (숫자, 특수문자) 그대로 반환
|
||||
return char;
|
||||
};
|
||||
// 기타 문자 (숫자, 특수문자) 그대로 반환
|
||||
return char;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user