thanks Spoo for your respon's![]()
before getting this case
, I have a case like this:Code:958.30.65.667.54.222.4444.9876x10.20.999.8765.7654.10.90.21x125
where the number of Digit After x (before the new dot(".")) isCode:958.30.65.667.54.222.4444.9876x10,20.999.8765.7654.10.90.21x125
min=1
max=4
and i used this code for fro get the "X" location
and now, on the new case, the coma(",") symbol have been change with dot (".") symbolCode:'Spilit the text Private Function SplitTextNew(ByVal text As String, ByVal digit As Integer, Optional ByVal isDigitAfterX As Boolean = False) As String Dim arrText1() As String Dim arrText2() As String Dim tmpText As String Dim i As Integer arrText1 = Split(text, "x", , vbTextCompare) If isDigitAfterX Then SplitTextNew = arrText1(UBound(arrText1)) Else arrText2 = Split(arrText1(0), ".") For i = 0 To UBound(arrText2) If Len(arrText2(i)) = digit Then tmpText = tmpText & arrText2(i) & "." End If Next i If Len(tmpText) > 0 Then tmpText = Left(tmpText, Len(tmpText) - 1) SplitTextNew = tmpText End If End Function Private Sub Command7_Click() Dim strText As String Dim arrKoma() As String Dim arrX() As String Dim i As Integer strText = Text1.text If InStr(strText, ",") Then arrKoma = Split(strText, ",") For i = 0 To UBound(arrKoma) arrX = Split(arrKoma(i), "x") 'save 2 digit Set lstV = ListView1.ListItems.Add(, , SplitTextNew(arrX(0), 2)) lstV.SubItems(1) = SplitTextNew(arrX(1), 2, True) 'save 3 digit Set lstV = ListView2.ListItems.Add(, , SplitTextNew(arrX(0), 3)) lstV.SubItems(1) = SplitTextNew(arrX(1), 3, True) 'save 4 digit Set lstV = ListView3.ListItems.Add(, , SplitTextNew(arrX(0), 4)) lstV.SubItems(1) = SplitTextNew(arrX(1), 4, True) DoEvents Next i End If End Sub
iam confused, how to get the "." after Digit After "x" (in the previous case get the "," after Digit After "x")Code:958.30.65.667.54.222.4444.9876x10.20.999.8765.7654.10.90.21x125





Reply With Quote
