Q: Manipulating strings
danny.troll@frankfurt.netsurf.de (Danny Troll) wrote: vname=TEXT1&nname=TEXT2&land=TEXT3&age=16 I have this text and want that: TEXT1 TEXT2 TEXT3 16 A: use the VB command INSTR: Private Sub Command9_Click() 'vname=TEXT1&nname=TEXT2&land=TEXT3&age=16 '>I have this text and want that: '>TEXT1 TEXT2 '>TEXT3 '>16 Sub Convert(strSource as String) Dim strDummy As String Dim y As Integer Dim x As Integer Dim z As Boolean Dim intFileNumber As Integer Dim strFileName As String Dim intCounter As Integer strDummy = strSource z = True intFileNumber = FreeFile strFileName = Environ("temp") & "\test.txt" Open strFileName For Append As intFileNumber For intCounter = 1 To Len(strSource) y = InStr(strDummy, "=") If y <> 0 Then 'MsgBox Right$(strDummy, Len(strDummy) - y) strDummy = Right$(strDummy, Len(strDummy) - y) x = InStr(strDummy, "&") If x <> 0 Then 'MsgBox Left$(strDummy, x - 1) 'write to file If z Then Print #intFileNumber, Left$(strDummy, x - 1) & " "; z = False Else Print #intFileNumber, Left$(strDummy, x - 1) EndIf End If Next intCounter 'MsgBox strDummy Print #intFileNumber, strDummy Close intFileNumber End Sub use it as Call Convert("vname=TEXT1&nname=TEXT2&land=TEXT3&age=16") Return