VB.NET Programming
[VBNET] Encoding Class - 유니코드 문자열 존재 여부
ZerosKD
2020. 4. 29. 16:29
반응형
* VBNET Encoding Class 를 이용한 유니코드(한글) 문자열 존재 여부 예제...
- 사용한 컨트롤 : Button 1개, TextBox 1개, Label 1개
전체 소스 코드
Form1.vb
Public Class Form1
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
If textBox1.Text = "" Then
Return
End If
Dim iAscii As Integer = System.Text.Encoding.ASCII.GetByteCount(textBox1.Text)
Dim iUnicode As Integer = System.Text.Encoding.UTF8.GetByteCount(textBox1.Text)
'같지 않으면...
If iAscii <> iUnicode Then
label1.Text = "Unicode 가 존재 합니다."
Else
label1.Text = "Unicode 가 존재 하지 않습니다."
End If
End Sub
End Class
*예제 결과
https://kdsoft-zeros.tistory.com/198
반응형