Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > parsing > tokenizeInterpolation
utils.parsing.tokenizeInterpolation() function
Parse a string with any number of interpolation tokens (%1, %2, ...). It will also replace string table references (e.g., %{bky_my_msg} and %{BKY_MY_MSG} will both be replaced with the value in Msg['MY_MSG']). Percentage sign characters '%' may be self-escaped (e.g., '%%'). Newline characters will also be output as string tokens containing a single newline character.
Signature:
export declare function tokenizeInterpolation(message: string): (string | number)[];
Parameters
Parameter |
Type |
Description |
message |
string |
Text which might contain string table references and interpolation tokens. |
Returns:
(string | number)[]
Array of strings and numbers.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["`utils.parsing.tokenizeInterpolation` parses a string, identifying interpolation tokens (%1, %2, etc.), string table references (%{bky_my_msg}), and escaped percentage signs (%%), returning an array of strings and numbers."],["It handles string table references by replacing them with their corresponding values from the `Msg` object, allowing for dynamic text insertion."],["The function also treats newline characters as individual string tokens to preserve formatting in the output."]]],[]]