「VB.net」CCharでString式の最初の文字をchar型に変換
書式
CChar
任意の有効な Char または String 式。String の最初の文字のみが変換されます。
使用例
Module Module1
Sub Main()
Dim str, strB As String
Dim resChar As Char
str = "BMW"
strB = ",INFO"
'CChar関数を使用して、文字列の最初の文字をCharに変換
resChar = CChar(str)
Console.WriteLine(resChar)
resChar = CChar(strB)
Console.WriteLine(resChar)
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim str, strB As String
Dim resChar As Char
str = "BMW"
strB = ",INFO"
'CChar関数を使用して、文字列の最初の文字をCharに変換
resChar = CChar(str)
Console.WriteLine(resChar)
resChar = CChar(strB)
Console.WriteLine(resChar)
Console.ReadKey()
End Sub
End Module
Module Module1 Sub Main() Dim str, strB As String Dim resChar As Char str = "BMW" strB = ",INFO" 'CChar関数を使用して、文字列の最初の文字をCharに変換 resChar = CChar(str) Console.WriteLine(resChar) resChar = CChar(strB) Console.WriteLine(resChar) Console.ReadKey() End Sub End Module
結果
B
,