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.

String.split nach '|'

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

für einige sollte das eine einfache Frage sein. Leider komme ich gerade nicht drauf und benötige deshalb Hilfe.

Wie splitte ich einen String nach '|' [pipe]?

tstString.split("|") funktioniert definitiv nicht. Ich komme einfach nicht drauf und kenne mich mit den Regex zu wenig aus.

Vielen dank für die Hilfe

Markus

EDIT: Habe das Problem doch noch selbst lösen können:

tstString.split("\\|");

also in java script ist es so:


 var leString = "Dies|ist|ein|String"


 var teil = leString.split("|");


zurueckgegeben wird ein Array -.-

teil[0] = "Dies";

teil[1] = "ist";

teil[2] = "ein";

teil[3] = "String";

... =) duerfte in java eigentlich nicht viel anders sein^^

so long,

Maddin:cool:

Ist aber anders - siehe EDIT im Eingangspost.

habs schon nachm absenden dann gesehen ^^ sry

Hey sei gegrüsst....

Probiers mal so...

String split = "Das|soll|gesplittet|werden";

String[] arr = new String[3];

arr = split.split("\\|");

//und dann die Ausgabe hier.....

Grüße


String myS = "ja1|ja2|ja3";


        for (String string : myS.split("\\|")) {

			System.out.println(string);

	}

Hey,

wenn noch 5 die Lösung posten die er selber schon längst herausgefunden hat, fass ich mir an Kopp. :rolleyes:

Gruß Jaraz ;)

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.