
07/10/2010, 22:01
|
| | Fecha de Ingreso: septiembre-2009 Ubicación: Medellin
Mensajes: 21
Antigüedad: 15 años, 5 meses Puntos: 0 | |
Respuesta: Visual Basic 2010, busco forma de separar términos pongo el siguiente codigo que los que hace es separar la exprecion en un arreglo.
luego pongo cada escprecion en una linea del texbox7.
Código:
Public Sub separarn(ByVal exp As String)
Dim separados(100) As String
Dim encontro As Boolean = False
Dim c = 0
For i = 0 To exp.Length - 1
If exp.Substring(i, 1) <> "+" And exp.Substring(i, 1) <> "-" And exp.Substring(i, 1) <> "/" And exp.Substring(i, 1) <> "*" And exp.Substring(i, 1) <> "=" Then
separados(c) = separados(c) + exp.Substring(i, 1)
End If
If exp.Substring(i, 1) = "+" Or exp.Substring(i, 1) = "-" Or exp.Substring(i, 1) = "/" Or exp.Substring(i, 1) = "*" Or exp.Substring(i, 1) = "=" Then
c = c + 1
separados(c) = exp.Substring(i, 1)
c = c + 1
End If
Next
TextBox7.Text = ""
For Each var As String In separados
If var <> "" Then
TextBox7.Text = TextBox7.Text + var + vbCrLf
End If
Next
End Sub
|