create procedure SIN_KUNNR_SEARCH
@startchar varchar(2)
as
begin
declare @hangle_jaeum varchar(100)
declare @english varchar(100)
declare @count varchar(100)
declare @endchar varchar(2)
set @hangle_jaeum = 'ㄱㄴㄷㄹㅁㅂㅅㅇㅈㅊㅋㅌㅍㅎ힣'
set @english ='ABCDEFGHIJKLMNOPQRSTUVWXYZ('
set @count = '1234567890'
set @endchar = SUBSTRING(@hangle_jaeum, charindex( @startchar, @hangle_jaeum, 0 )+1, 1 )
if charindex( @startchar, @english, 0 )>0
begin select NAME1 from SIN_KUNNR where substring(NAME1,1,1)between 'a' and 'z' order by NAME1
end
else if charindex( @startchar, @count, 0)>0
begin select NAME1 from SIN_KUNNR where substring(NAME1,1,1) between '0' and '9' order by NAME1
end
else if charindex( @startchar, @hangle_jaeum, 0 )>0
begin select NAME1 from SIN_KUNNR where NAME1 between @startchar and @endchar
end
end
11/11/2010
문자열 받아서 초성값 넘기기
public string chosungfuncFind(String origString)
{
tmpData = "";
choValue = "";
//Console.WriteLine(origString.Length);
for (int i = 0; i < origString.Length; i++)
{
tmpData = origString.Substring(i, 1);
char origChar = tmpData.ToCharArray(0, 1)[0];
int unicode = Convert.ToInt32(origChar);
uint jongCode = 0;
uint jungCode = 0;
uint choCode = 0;
if (unicode < 44032 || unicode > 55203)
{
choValue += tmpData;
//Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, origString, "", "");
}
else
{
uint uCode = Convert.ToUInt32(origChar - '\xAC00');
jongCode = uCode % 28;
jungCode = ((uCode - jongCode) / 28) % 21;
choCode = ((uCode - jongCode) / 28) / 21;
char[] choChar = new char[] { 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
choValue += choChar[choCode];
}
//char[] jungChar = new char[] { 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' };
//char[] jongChar = new char[] { ' ', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
//Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, choChar[choCode].ToString(), jungChar[jungCode].ToString(), jongChar[jongCode].ToString());
}
//MessageBox.Show(choValue);
cnt++;
Console.WriteLine(choValue +"___"+ cnt);
/* char origChar = origString.ToCharArray(0, 1)[0];
int unicode =Convert.ToInt32(origChar);
uint jongCode = 0;
uint jungCode = 0;
uint choCode = 0;
if(unicode < 44032 || unicode > 55203)
Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, origString,"","");
else
{
uint uCode =Convert.ToUInt32(origChar -'\xAC00');
jongCode = uCode % 28;
jungCode = ((uCode - jongCode) / 28) % 21;
choCode = ((uCode - jongCode) / 28) / 21;
}
char[] choChar =new char[] {'ㄱ','ㄲ','ㄴ','ㄷ','ㄸ','ㄹ','ㅁ','ㅂ','ㅃ','ㅅ','ㅆ','ㅇ','ㅈ','ㅉ','ㅊ','ㅋ','ㅌ','ㅍ','ㅎ'};
char[] jungChar =new char[]{'ㅏ','ㅐ','ㅑ','ㅒ','ㅓ','ㅔ','ㅕ','ㅖ','ㅗ','ㅘ','ㅙ','ㅚ','ㅛ','ㅜ','ㅝ','ㅞ','ㅟ','ㅠ','ㅡ','ㅢ','ㅣ'};
char[] jongChar =new char[]{' ','ㄱ','ㄲ','ㄳ','ㄴ','ㄵ','ㄶ','ㄷ','ㄹ','ㄺ','ㄻ','ㄼ','ㄽ','ㄾ','ㄿ','ㅀ','ㅁ','ㅂ','ㅄ','ㅅ','ㅆ','ㅇ','ㅈ','ㅊ','ㅋ','ㅌ','ㅍ','ㅎ'};
Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, choChar[choCode].ToString(), jungChar[jungCode].ToString(), jongChar[jongCode].ToString());
*/ return choValue;
}
{
tmpData = "";
choValue = "";
//Console.WriteLine(origString.Length);
for (int i = 0; i < origString.Length; i++)
{
tmpData = origString.Substring(i, 1);
char origChar = tmpData.ToCharArray(0, 1)[0];
int unicode = Convert.ToInt32(origChar);
uint jongCode = 0;
uint jungCode = 0;
uint choCode = 0;
if (unicode < 44032 || unicode > 55203)
{
choValue += tmpData;
//Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, origString, "", "");
}
else
{
uint uCode = Convert.ToUInt32(origChar - '\xAC00');
jongCode = uCode % 28;
jungCode = ((uCode - jongCode) / 28) % 21;
choCode = ((uCode - jongCode) / 28) / 21;
char[] choChar = new char[] { 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
choValue += choChar[choCode];
}
//char[] jungChar = new char[] { 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' };
//char[] jongChar = new char[] { ' ', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' };
//Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, choChar[choCode].ToString(), jungChar[jungCode].ToString(), jongChar[jongCode].ToString());
}
//MessageBox.Show(choValue);
cnt++;
Console.WriteLine(choValue +"___"+ cnt);
/* char origChar = origString.ToCharArray(0, 1)[0];
int unicode =Convert.ToInt32(origChar);
uint jongCode = 0;
uint jungCode = 0;
uint choCode = 0;
if(unicode < 44032 || unicode > 55203)
Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, origString,"","");
else
{
uint uCode =Convert.ToUInt32(origChar -'\xAC00');
jongCode = uCode % 28;
jungCode = ((uCode - jongCode) / 28) % 21;
choCode = ((uCode - jongCode) / 28) / 21;
}
char[] choChar =new char[] {'ㄱ','ㄲ','ㄴ','ㄷ','ㄸ','ㄹ','ㅁ','ㅂ','ㅃ','ㅅ','ㅆ','ㅇ','ㅈ','ㅉ','ㅊ','ㅋ','ㅌ','ㅍ','ㅎ'};
char[] jungChar =new char[]{'ㅏ','ㅐ','ㅑ','ㅒ','ㅓ','ㅔ','ㅕ','ㅖ','ㅗ','ㅘ','ㅙ','ㅚ','ㅛ','ㅜ','ㅝ','ㅞ','ㅟ','ㅠ','ㅡ','ㅢ','ㅣ'};
char[] jongChar =new char[]{' ','ㄱ','ㄲ','ㄳ','ㄴ','ㄵ','ㄶ','ㄷ','ㄹ','ㄺ','ㄻ','ㄼ','ㄽ','ㄾ','ㄿ','ㅀ','ㅁ','ㅂ','ㅄ','ㅅ','ㅆ','ㅇ','ㅈ','ㅊ','ㅋ','ㅌ','ㅍ','ㅎ'};
Console.WriteLine("{0}의 초성 : {1}, 중성 : {2}, 종성 : {3}", origString, choChar[choCode].ToString(), jungChar[jungCode].ToString(), jongChar[jongCode].ToString());
*/ return choValue;
}
Subscribe to:
Posts (Atom)