You are here

function _charts_google_escape_icu_characters in Charts 7.2

Same name and namespace in other branches
  1. 8 modules/charts_google/charts_google.inc \_charts_google_escape_icu_characters()

Utility to escape special characters in ICU number formats.

Google will use the ICU format to auto-adjust numbers based on special characters that are used in the format. This function escapes these special characters so they just show up as the character specified.

The format string is a subset of the ICU pattern set. For instance, {pattern:'#,###%'} will result in output values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.

1 call to _charts_google_escape_icu_characters()
_charts_google_populate_chart_data in modules/charts_google/charts_google.inc
Utility to populate chart data.

File

modules/charts_google/charts_google.inc, line 331
Callbacks and utility functions for rendering a Google Chart.

Code

function _charts_google_escape_icu_characters($string) {
  return preg_replace('/([0-9@#\\.\\-,E\\+;%\'\\*])/', "'\$1'", $string);
}