[Solved] How can I separate a single String into two parts? [duplicate]

You used to have str.split(“,”); and split() is a void method. It doesn’t alter str. you could fix it by replacing str.split(“,”) with: str = str.split(“,”), or you could put it all on one line like: while ((str = br1.readLine()) != null) userstr.add(str.split(“,”)[0]); 2 solved How can I separate a single String into two parts? … Read more

[Solved] PHP: Breaking a string into multiple lines and manipulating each line separately [closed]

Simply use the explode() function with PHP_EOL constant as delimiter: $lines = explode(PHP_EOL, $original); After you can iterate the returned array to parse lines, for example: foreach ( $lines as $line ) { echo ‘<span>’.$line.'</span>’; } 3 solved PHP: Breaking a string into multiple lines and manipulating each line separately [closed]