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.

Empfohlene Antworten

Veröffentlicht

hallo,

ich habe eine textdatei mit folgendem Inhalt:

: not found

|bad-item

|Cannot find

|All rpms were build

|Cannot read

Diese werden mittels BufferedReader eingelsen und später als Regex verwendet.

Nun möchte ich gerne, dass man hinter die einzelen Begriffe noch sowas wie Kommentare zufügt, ohne das Sie als Regex gelten.

Also so z.B.

: not found //tritt auf, wenn dies un jenes passiert

|bad-item // ist ein bekanntes problem wenn...

man müsste also den String von den Kommentaren trennen. Aber wie macht man das am geschicktesten..?

Wenn man mir helfen könnte, wär ich sehr dankbar..! :)

Zum besseren Verständis poste ich noch den Code dazu:

		// Suchwörter-Datei einlesen
BufferedReader sWoerterBuffer = new BufferedReader(new FileReader(
Abfragen.sWoerterDatei));
String sWoerterRead = null;
String sWoerter = "";
while ((sWoerterRead = sWoerterBuffer.readLine()) != null) {
sWoerter += sWoerterRead;
}[/PHP]

Wenn du die Zeile in deiner Variable hast mit string.indexof nach "//" suchen und falls ein Kommentar vorhanden ist, mit Substring aufteilen.

Setzt natürlich voraus, dass pro Zeile nur ein Eintrag ist, und der Kommentar nicht weiter als eine Zeile geht

Bearbeitet von Thelvan

danke..! funktioniert. hab das so wie es Thelvan beschrieben hat programmiert. :)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.