pos multimethod

Methods

pos(haystack:Str, needle:Str, start:Int)
Find substring position

Parameters

startNon-negative Int, position where the search starts

Returns

Int or null. Not -1 as in many languages
pos(haystack:Str, needle:Str) Source: stdlib.ngs:3411
Find substring in a string.

Parameters

haystackThe string to search in
needleThe string to find

Returns

Int or null

Example

pos("abc", "cd")     # null
pos("abcdef", "cd")  # 2