แบบสำรวจการวิจัย: บอกให้เราทราบเกี่ยวกับประสบการณ์การใช้งาน Blockly
เริ่มแบบสำรวจ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
blockly > CodeGenerator > injectId
เมธอด CodeGenerator.injectId()
แทรกรหัสบล็อกลงในข้อความเพื่อแทนที่ "%1" ใช้สำหรับ STATEMENT_PREFIX, STATEMENT_SUFFIX และ INFINITE_LOOP_TRAP
ลายเซ็น:
injectId(msg: string, block: Block): string;
พารามิเตอร์
พารามิเตอร์ |
ประเภท |
คำอธิบาย |
msg |
สตริง |
ข้อมูลโค้ดที่มี "%1" |
บล็อก |
บล็อก |
บล็อกที่มีรหัส |
การคืนสินค้า:
สตริง
ข้อมูลโค้ดที่มีรหัส
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-08-21 UTC
[[["เข้าใจง่าย","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"]],["อัปเดตล่าสุด 2024-08-21 UTC"],[[["The `injectId` method replaces '%1' in a code snippet with a block's ID."],["It's primarily used for statement prefixes, suffixes, and infinite loop traps."],["The method takes the code snippet and the block as input."],["It returns the modified code snippet with the block ID injected."]]],["The `injectId` method, part of the `CodeGenerator` class, replaces the '%1' placeholder within a code snippet (`msg`) with the ID of a specified `Block`. This functionality is utilized for `STATEMENT_PREFIX`, `STATEMENT_SUFFIX`, and `INFINITE_LOOP_TRAP`. It takes a string (`msg`) and a `Block` as input, then returns the modified code snippet with the block's ID inserted.\n"]]