CaelLabWiki, the encyclopedia that sets knowledge sailing lightly.
{{{1}}}
{{replace|字串|替換原文|替換為|count=替換次數}}
將字串填入模板參數1,輸出時每出現一個參數2的指定原文,就會被替換為參數3的文字,可以用count參數限制替換次數(不指定則全部替換)。前三個參數對所有空格敏感。
{{replace|One two two three two four twotwo five|two|NINE}} → One NINE NINE three NINE four NINENINE five
{{replace|One two two three two four twotwo five|two|NINE|count=2}} → One NINE NINE three two four twotwo five
{{replace|One-two two-three two-four twotwo-five|-|—}} → One—two two—three two—four twotwo—five
{{replace|One-two two-three two-four twotwo-five|- |—}} → One-two two-three two-four twotwo-five
根据数量处理
| | | 模板链接:{{str right}} | 返回从左向右移除若干个字符后的字符串 | | 模板链接:{{str rightc}} | 返回从后向前指定数量的字符串,如果字符串为空则返回一个参数 | | 模板链接:{{str rightmost}} | To trim down to the last specified number of characters. | | 模板链接:{{str sub old}} | To trim down to a specified number, starting at a given number from the left. | | 模板链接:{{str sub new}} | Select a substr based on starting and ending index. | | 模板链接:{{str index}} | 返回字符串的第×个字符 |
|
根据条件处理
专用于Wiki语法
| | | 模板链接:{{WikiProjectbasename}} | Removes "WikiProject" from a pagename. | | 模板链接:{{remove unranked}} | Removes the string "unranked_" from the left of a string (taxonomy). | | 模板链接:{{ship prefix}} | Returns the length of a ship's name prefix, if listed (ship names). | | 模板链接:{{title year}} | Returns the 4-digit year from a pagename, if any. |
|
插入、替換、長度
| 模板链接:{{strloc insert}} | Inserts a string at character location strloc, or appends if strloc<=0. | | 模板链接:{{loop}} | 特定次數重複字串。 | | 模板链接:{{replace}} | 在字串中查找並全部替換某字串後返回。 | | 模板链接:{{str rep}} | 在字串中查找並替換首次出現的某字串後返回。 | | 模板链接:{{digits}} | 移除字串中不是數字(0~9)的字元。 |
|
| 模板链接:{{str len}} | 返回字串長度。 | | 模板链接:{{str ≥ len}} | 檢查一個字串和某一給定長度相比是「更長或等長」還是「更短」。 | | 模板链接:{{str ≤ len}} | 檢查一個字串和某一給定長度相比是「更短或等長」還是「更長」。 | | 模板链接:{{str ≠ len}} | 檢查一個字串和某一給定長度相比是「不等長」還是「等長」。 | | 模板链接:{{str ≤ ≥ len}} | 檢查一個字串和某一給定長度相比是「更短」、「等長」還是「更長」。 |
|
分析、技術