String matching: Difference between revisions

Content added Content deleted
m (Add Julia 1.0 version)
Line 1,675: Line 1,675:
3: Does 'tacoloco' end with 'co'? Yes.</pre>
3: Does 'tacoloco' end with 'co'? Yes.</pre>


=={{header|Lasso}}==

<lang Lasso>local(
a = 'a quick brown peanut jumped over a quick brown fox',
b = 'a quick brown'
)

//Determining if the first string starts with second string
#a->beginswith(#b) // true

//Determining if the first string contains the second string at any location
#a >> #b // true
#a->contains(#b) // true

//Determining if the first string ends with the second string
#a->endswith(#b) // false</lang>


=={{header|jq}}==
=={{header|jq}}==
Line 1,731: Line 1,715:




=={{header|Julia }}==
<lang julia>
startswith("abcd","ab") #returns true
findfirst("ab", "abcd") #returns 1:2, indices range where string was found
endswith("abcd","zn") #returns false
match(r"ab","abcd") != Nothing #returns true where 1st arg is regex string
for r in eachmatch(r"ab","abab")
println(r.offset)
end #returns 1, then 3 matching the two starting indices where the substring was found
</lang>


=={{header|Julia}}==
<lang julia>startswith("abcd","ab") #returns true
search("abcd","ab") #returns 1:2, indices range where string was found
endswith("abcd","zn") #returns false
ismatch(r"ab","abcd") #returns true where 1st arg is regex string
julia>for r in each_match(r"ab","abab")
println(r.offset)
end
1
3</lang>


=={{header|K}}==
=={{header|K}}==
Line 1,764: Line 1,748:
_ss["abcdabceabc";"abc"] / location of matches
_ss["abcdabceabc";"abc"] / location of matches
0 4 8</lang>
0 4 8</lang>



=={{header|Kotlin}}==
=={{header|Kotlin}}==
Line 1,791: Line 1,776:
[[File:LabVIEW_Character_matching_2.png]]<br/>
[[File:LabVIEW_Character_matching_2.png]]<br/>
[[File:LabVIEW_Character_matching_3.png]]
[[File:LabVIEW_Character_matching_3.png]]


=={{header|Lasso}}==

<lang Lasso>local(
a = 'a quick brown peanut jumped over a quick brown fox',
b = 'a quick brown'
)

//Determining if the first string starts with second string
#a->beginswith(#b) // true

//Determining if the first string contains the second string at any location
#a >> #b // true
#a->contains(#b) // true

//Determining if the first string ends with the second string
#a->endswith(#b) // false</lang>


=={{header|Lang5}}==
=={{header|Lang5}}==