Modèle:Posnq/doc

De Wiki Electrolab
< Modèle:Posnq
Révision datée du 1 mai 2023 à 13:22 par Electrolab (discussion | contributions) (Page créée avec « Wrapper template for function posnq in Module:String2. * posnq (position, no quotes) returns the numerical start position of the first occurrence of one piece of text ("match") inside another ("str"). * It returns nil if no match is found, or if either parameter is blank. * It takes the text to be searched in as the first unnamed parameter, which is trimmed. * It takes the text to match as the second unnamed parameter, which is trimmed and any double quotes... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

Wrapper template for function posnq in Module:String2.

  • posnq (position, no quotes) returns the numerical start position of the first occurrence of one piece of text ("match") inside another ("str").
  • It returns nil if no match is found, or if either parameter is blank.
  • It takes the text to be searched in as the first unnamed parameter, which is trimmed.
  • It takes the text to match as the second unnamed parameter, which is trimmed and any double quotes " are stripped out. That allows spaces at the beginning or end of the match string to be included in a consistent manner.

Examples

  • {{Posnq |This is a piece of text to be searched |piece of }} → 11
  • {{Posnq |This is a piece oftext to be searched |piece of }} → 11
  • {{Posnq |This is a piece of text to be searched |"piece of "}} → 11
  • {{Posnq |This is a piece oftext to be searched |"piece of "}}
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.