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.

zeile nach bestimmten inhalt durchsuchen

Empfohlene Antworten

Veröffentlicht

Hy leute,

ich schreibe gerade ein programm in dem ich aus ner datei (.txt) etwas extrahieren will. dafür muss ich schauen ob ein bestimmter nhalt vorhanden ist, jedoch bekomme ich immer ne ReferenceNullExeption.

Hier mein code:(die rote zeile wird mir immer markiert!)


StreamReader objReader = new StreamReader(@Pfad);


            string sLine = "";

            ArrayList arrText = new ArrayList();


            while (sLine != null)

            {

                sLine = objReader.ReadLine();

                [COLOR="Red"]if (sLine.Contains("dergesuchteinhalt"))[/COLOR]

                {

                    arrText.Add(sLine);

                    sLine = null;

                }

            }

            objReader.Close();

            foreach (string sOutput in arrText)

                  Console.WriteLine(sOutput);

                Console.ReadLine();

                url = arrText[0].ToString();

                i = url.LastIndexOf("src=");

                i += 5;

                url = url.Remove(0, i);

                i = url.LastIndexOf(".jpg");

                url = url.Remove(i + 4);

                //url = url.Insert(i, "|");

                textBox2.Clear();

                textBox2.Text = url;




        }

    }

}


Ich hoff ihr könnt mir helfen

sLine ist null, weil ReadLine() nicht funktioniert.

Ist die Pfadangabe in Ordnung (Stichwort: relative/absolute Pfadangabe)??

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.