| Dieser Artikel wurde aus einer englischen Sprachversion importiert und wurde noch nicht vollständig übersetzt. Bitte hilf mit, den Text auf deutsch verfügbar zu machen. |
 |
Diese Vorlage benutzt Module:String, Skripte geschrieben in der Programmiersprache Lua. Bitte informiere dich dort, wenn du mehr über die Sprache und ihren Einsatz erfahren willst. Diese Vorlagen sollte im Regelfall nicht ersetzt werden. |
This is the {{str len}} meta-template.
It takes a string as parameter and returns its length (excluding spaces at the start and end). It can now count as high as necessary.
Examples
If the parameter is empty or undefined it is considered to be of zero length:
{{str len}}
returns 0
{{str len|}}
returns 0
{{str len| }}
returns 0
It counts the length correctly, even if the string contains spaces, looks like a number, or contains special characters:
{{str len| ab cde }}
returns 6
{{str len| 1234567 }}
returns 7
{{str len| café åäö }}
returns 8
{{str len| 499-characters... }}
returns 499
{{str len| 1000-characters... }}
returns 1000
Template data
Dies ist die TemplateData-Dokumentation für diese Vorlage, die vom neuen VisualEditor eingesetzt wird.
Str len
The template takes a string as parameter and returns its length, excluding spaces at the start and end of the string
Vorlagenparameter
Parameter | Beschreibung | Typ | Status |
---|
Alpha-numeric text | 1 | The string to be counted
| Zeichenfolge | erforderlich |
---|
Technical details
This is the first general-purpose template to be implemented using mw:Extension:Scribunto. The Lua code is located in Module:String.
See also
Siehe auch
Vorlagen zur Zeichenkettenmanipulation |
---|
|
|
|
Trimmen nach Anzahl |
- {{Str mid}} – Gibt einen Teilstring unter Angabe von Position und Länge zurück.
- {{Trunc}} – Reduziert eine Zeichenkette auf eine Solllänge.
- {{Str left}} – Reduziert eine Zeichenkette auf eine Sollänge von links an gezählt oder füllt eine Zeichenkette durch Duplizierung auf eine Solllänge auf.
- {{Str crop}} – Schneidet eine bestimmte Anzahl von Zeichen am Ende ab.
- {{Chop head and tail}} – Schneidet eine bestimmte Anzahl von Zeichen am Anfang und Ende ab.
- {{Str right}} – Schneidet eine bestimmte Anzahl von Zeichen am Ende ab.
- {{Str rightc}} – Gibt die übergebene Anzahl von Zeichen vom Ende der Zeichenkette zurück.
- {{Str rightmost}} – Kürzt eine Zeichenkette auf die angegebene Anzahl am Ende.
- {{Str sub old}} – Kürzt eine Zeichenkette auf eine bestimmte Anzahl, gestartet an der angegebenen Position.
- {{Str sub new}} – Gibt eine Teilzeichenkette unter Angabe von Start- und Endposition zurück.
- {{Str index}} – Gibt den Buchstaben an einer bestimmten Position zurück.
|
---|
|
Trimmen nach Bedingung | |
---|
|
Zeichen einfügen |
- {{Loop}} – Repeat character string n times
- {{Replace}} – Returns the string, after replacing all occurrences of a specified string with another string.
- {{Strloc insert}} – Inserts a string at character location strloc, or appends if strloc<=0.
- {{Strloc prefix}} – Extracts string prefix up to location strloc, or whole string if strloc<=0.
- {{Str rep}} – Returns the string, after replacing the first occurrence of a specified string with another string.
|
---|
|
Längenauswertungen |
- {{Str len}} – Returns a string's length.
- {{Str ≥ len}} – To check if a string is "longer or equally long" or "shorter" than a given length.
- {{Str ≤ len}} – To check if a string is "shorter or equally long" or "longer" than a given length.
- {{Str ≠ len}} – To check if a string is "not equal" or "equal" to a given length.
- {{Str ≤ ≥ len}} – To check if a string is "shorter", "equal", or "longer" than a given length.
|
---|
|
Analyse |
- {{Str endswith}} – To check if a string ends with a given string.
- {{Str find}} – Returns the numerical location of a given string in a string.
- {{Strfind short}} – Returns the numerical location of a given string in a string.
- {{Str find0}} – Zero-based substring search.
- {{Str sub find}} – Searches a substring in a string at the given offset.
- {{ASCII code}} – Returns the ASCII value of a single character.
- {{Str letter}} – Returns the number of letters that begin a string.
- {{Str number}} – Returns the number of numbers that begin a string.
- {{Str gtr str}} – Compares two strings for alphabetical order, and returns a value accordingly.
|
---|
|
Spezialanwendungen | |
---|
|
Technisches | |
---|
|
|