Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Textdatei auslesen

Empfohlene Antworten

Veröffentlicht

hi, ich will aus einer textdatei Variabeln auszulesen, die in jeder zeile stehen:

jede zeile fängt mit 'Dim' vor der zu suchenden variabeln an, nach dem variabel kommt nach einem leerzeichen 'As' für die Zuweisung der Variabel

also etwa so sieht das aus:

Dim Variabel As

ich bin so vorgegangen: Nach dem ich die Variabeln für den Code deklariert habe und Pfade zum Öffnen der Datei und zum Schreiben einer Datei bestimmt habe fängt meine schleife an:

While Not EOF(1)

Line Input #1, strZeile

If InStr(strZeile, "Dim") Then 'Suche nach Dim

strName = Mid(strZeile, 5 - InStr(Text$, "As")) 'ab 5.zeichen ausschneiden

'bis in Text As beginnt

txtdisplay = txtdisplay & strName & " " 'Ausgabe

End If

Wend

das programm schneidet nach dem leerzeichen (nach dim) zwar den gesuchten string raus aber macht kein stopp vor dem As

wie musste ich sonst den variabel in der zeile rauschneiden??

thx

Private Sub Command1_Click()

Dim a, b As Integer

Dim c, d As String

d = "Dim vari As Integer"

c = UCase(d)

a = UCase(InStr(1, c, "DIM"))

b = UCase(InStr(1, c, "AS"))

d = Mid(d, a + 4, b - a - 5)

MsgBox d

End Sub

Die Korrekturen +4 / -5 sind für Dim und AS

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.