Deutsches LiveCode Wiki
Advertisement

Engl. Offset = Abstand

Gibt die Anzahl der Zeichen zwischen dem ersten Zeichen eines Containers und dem Auftreten des spezifischen Zeichens an:

Syntax:

offset(<Gesuchte_Zeichen>, <zu_durchsuchende_Zeichenkette> [, <zu_überspringende_Zeichen>])

Examples:

offset("c","abcde") -- ergibt 3
offset("b","abacadabra",2) -- ergibt 6 (weil erst ab dem zweiten Zeichen geuscht wird)
offset("bark","embarking") -- ergibt 3 

Benutze die offset-Funktion um herauszufinden, wo ein string in einem anderen string vorkommt.

The value returned by the offset function is the number of the character where charsToFind appears in stringToSearch. If the charsToFind is not in stringToSearch, the offset function returns zero.

If the charsToFind contains more than one character, and the entire charsToFind appears in the stringToSearch, the offset function returns the character number where the charsToFind starts.

If you specify how many charsToSkip, the offset function skips the specified number of characters in the stringToSearch. The value returned is relative to this starting point instead of the beginning of the stringToSearch.

Parameters:

  • charsToFind (string):
  • stringToSearch (string):
  • charsToSkip:A non-negative integer. If you don't specify how many charsToSkip, theoffset function does not skip any items and starts at the beginning ofthe stringToSearch.
  • Returns: The offset function returns a non-negative integer.

See also: function (control structure),wordOffset (function),itemOffset (function),length (function),lineOffset (function),value (function),begins with (operator),

Advertisement