סקר מחקר: נשמח לשמוע על החוויה שלך עם Blockly
לפתיחת הסקר
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
blockly > utils > string > commonWordPrefix
הפונקציה utils.string.commonWordPrefix()
בהינתן מערך של מחרוזות, מחזירה את אורך הקידומת המשותפת. אי אפשר לפצל את המילים. כל רווח אחרי מילה נכלל באורך.
Signature:
export declare function commonWordPrefix(array: string[], opt_shortest?: number): number;
פרמטרים
פרמטר |
סוג |
תיאור |
מערך |
String[] |
מערך של מחרוזות. |
opt_shortest |
number |
(אופציונלי) אורך המחרוזת הקצרה ביותר. |
החזרות:
number
אורך של קידומת משותפת.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-09-12 (שעון 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-09-12 (שעון UTC)."],[[["The `commonWordPrefix` function calculates the length of the common prefix shared by an array of strings."],["It considers spaces after words as part of the prefix length and doesn't split words."],["An optional `opt_shortest` parameter can be provided to specify the length of the shortest string in the array for optimization."],["The function returns a number representing the length of the common prefix found."]]],[]]