File:  [parser3project] / parser3 / tests / 477.html
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Sun Nov 1 15:24:35 2026 UTC (2 weeks, 3 days ago) by moko
Branches: MAIN
CVS tags: HEAD
rpos UTF-8 and pos/rpos Windows-1251 tests added (related to feature #1180)

# ^string.pos[substr](n) and ^string.rpos[substr](n) in a single-byte charset (the default one is UTF-8):
# n is the lowest position of the substr start for pos and the highest one for rpos
@main[]
^1251[]

$empty[]

1. the results for n=0..length and n=100:
^scan[a.b.c.d;.]
^scan[abab;ab]
^scan[aaaa;aa]
^scan[abacad;ab]
^scan[abab;abab]
^scan[abab;ababa]
^scan[привет, мир, пока;, ]
^scan[привет, мир, пока;ир]
^scan[привет, мир, пока;я]
^scan[abab;$empty]
^scan[$empty;a]

2. the string made of pieces, not of one literal:
$p[ab.]$q[.cd.ef]
^scan[${p}${q};.]

3. wrong parameters:
$s[a.b.c.d]
^show{^^s.rpos[.](-1)}
^show{^^s.rpos[.](x)}
^show{^^s.rpos{.}}

@scan[str;substr]
<b>'$str' '$substr'</b><br />
^line[$str;$substr;pos]
^line[$str;$substr;rpos]

@line[str;substr;method][len;n]
$len(^str.length[])
${method}: ^str.$method[$substr]; (0..$len) ^for[n](0;$len){^str.$method[$substr]($n)}[ ]; (100) ^str.$method[$substr](100)<br />

@show[code]
${code}: ^try-catch-comment{^process{$code}}<br />

E-mail: