/ LJCPHPCodeDoc / LJCCommonLib / LJC / NewLineTrim


Parameters
$text - The text value.

Returns

The text without the trailing newline.

Syntax

PHP
public static function NewLineTrim(string $text): string

Removes the trailing newline from the text.

Example

PHP
 // Removes newline from text.
 private static function NewLineTrim()
 {
   $text = "Now\r\n";
   $result = LJC::NewLineTrim($text);
 
   // result:
   // Now
 
   $text = "Now\n";
   $result = LJC::NewLineTrim($text);
 
   // result:
   // Now
 }

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.