研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >实用程序 >解析 >tokenizeInterpolation
utils.parsing.tokenizeInterpolation() 函数
解析包含任意数量的插值令牌(%1、%2...)的字符串。它还将替换字符串表引用(例如,%{bky_my_msg} 和 %{BKY_MY_MSG} 都会替换为 Msg['MY_MSG']中的值)。百分号“%”可以自行转义(例如“%%”)。换行符也将输出为包含一个换行符的字符串标记。
Signature:
export declare function tokenizeInterpolation(message: string): (string | number)[];
参数
参数 |
类型 |
说明 |
消息 |
字符串 |
可能包含字符串表引用和插值标记的文本。 |
返回:
(字符串 | 数字)[]
由字符串和数字组成的数组。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-22。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-08-22。"],[[["`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."]]],[]]