Ðề: Tách chữ trong một dòng thành hai dòng?
Code day :
Public Function tinhsotienchu1(chuoi As String, LenChar As Integer)
Dim temptext, temptext1 As String
Dim i As Integer
temptext = chuoi
If Len(temptext) > LenChar Then
i = InStr(LenChar, temptext, " ")
If i <> 0 Then
temptext1 = Left(temptext, i)
tienbangchuchuoisau = Mid(temptext, i + 1, Len(temptext) - i)
Else
temptext1 = chuoi
tienbangchuchuoisau = ""
End If
Else
temptext1 = chuoi
tienbangchuchuoisau = ""
End If
tinhsotienchu1 = temptext1
End Function
Public Function tinhsotienchu2(chuoi As String, LenChar As Integer)
Dim temptext, temptext1 As String
Dim i As Integer
temptext = chuoi
If Len(temptext) > LenChar Then
i = InStr(LenChar, temptext, " ")
If i <> 0 Then
temptext1 = Left(temptext, i)
tienbangchuchuoisau = Mid(temptext, i + 1, Len(temptext) - i)
Else
temptext1 = chuoi
tienbangchuchuoisau = ""
End If
Else
temptext1 = chuoi
tienbangchuchuoisau = ""
End If
tinhsotienchu2 = tienbangchuchuoisau
End Function