You are here

public static function GeshiFilter::whitespaceExplode in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 src/GeshiFilter.php \Drupal\geshifilter\GeshiFilter::whitespaceExplode()

Helper function for splitting a string on white spaces.

Using explode(' ', $string) is not enough because it returns empty elements if $string contains consecutive spaces.

Parameters

string $string: The string to split by spaces.

Return value

array Return the string split by white spaces.

2 calls to GeshiFilter::whitespaceExplode()
GeshiFilterFilter::parseAttributes in src/Plugin/Filter/GeshiFilterFilter.php
Helper function for parsing the attributes of GeSHi code tags.
GeshiFilterFilter::tips in src/Plugin/Filter/GeshiFilterFilter.php
Get the tips for the filter.

File

src/GeshiFilter.php, line 135

Class

GeshiFilter
Contains constantas and some helper functions.

Namespace

Drupal\geshifilter

Code

public static function whitespaceExplode($string) {
  return preg_split('/\\s+/', $string, -1, PREG_SPLIT_NO_EMPTY);
}