module std/core/sslicestd/core/sslice
import std/core/typesstd/core/types
import std/core/undivstd/core/undiv
import std/core/unsafestd/core/unsafe import std/core/hndstd/core/hnd
import std/core/intstd/core/int
import std/core/stringstd/core/string
extern import
c file "inline/sslice"
js file "inline/sslice.js"
abstract value struct sslicestd/core/sslice/sslice: V( strstd/core/sslice/sslice/str: (sslice : sslice) -> string : stringstd/core/types/string: V, startstd/core/sslice/sslice/start: (sslice : sslice) -> int : intstd/core/types/int: V, lenstd/core/sslice/sslice/len: (sslice : sslice) -> int : intstd/core/types/int: V )
pub fun @new-sslice( strstr: string :stringstd/core/types/string: V, startstart: int: intstd/core/types/int: V, lenlen: int : intstd/core/types/int: V )result: -> total sslice
Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(strstr: string,startstart: int,lenlen: int)
pub fun (==)std/core/sslice/(==): (slice1 : sslice, slice2 : sslice) -> bool(slice1slice1: sslice: sslicestd/core/sslice/sslice: V, slice2slice2: sslice: sslicestd/core/sslice/sslice: V )result: -> total bool: boolstd/core/types/bool: V
match (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)slice1slice1: sslice, slice2slice2: sslice)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)
(std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(s1s1: string, start1start1: int, len1len1: int), Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(s2s2: string, start2start2: int, len2len2: int))std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) ->
if unsafe-ptr-eqstd/core/unsafe/unsafe-ptr-eq: (x : string, y : string) -> bool(s1s1: string,s2s2: string) &&std/core/types/(&&): (x : bool, y : bool) -> bool start1start1: int==std/core/int/(==): (x : int, y : int) -> boolstart2start2: int &&std/core/types/(&&): (x : bool, y : bool) -> bool len1len1: int==std/core/int/(==): (x : int, y : int) -> boollen2len2: int
then Truestd/core/types/True: bool else slice1slice1: sslice.stringstd/core/sslice/string: (slice : sslice) -> string ==std/core/string/(==): (string, string) -> bool slice2slice2: sslice.stringstd/core/sslice/string: (slice : sslice) -> string
pub fun (!=)std/core/sslice/(!=): (slice1 : sslice, slice2 : sslice) -> bool(slice1slice1: sslice: sslicestd/core/sslice/sslice: V, slice2slice2: sslice: sslicestd/core/sslice/sslice: V )result: -> total bool: boolstd/core/types/bool: V
!std/core/types/bool/(!): (b : bool) -> bool(slice1slice1: sslice ==std/core/sslice/(==): (slice1 : sslice, slice2 : sslice) -> bool slice2slice2: sslice)
pub fun (===)std/core/sslice/(===): (slice1 : sslice, slice2 : sslice) -> bool(slice1slice1: sslice: sslicestd/core/sslice/sslice: V, slice2slice2: sslice: sslicestd/core/sslice/sslice: V )result: -> total bool: boolstd/core/types/bool: V
match (std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)slice1slice1: sslice, slice2slice2: sslice)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)
(std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(s1s1: string, start1start1: int, len1len1: int), Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(s2s2: string, start2start2: int, len2len2: int))std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b) -> (start1start1: int==std/core/int/(==): (x : int, y : int) -> boolstart2start2: int &&std/core/types/(&&): (x : bool, y : bool) -> bool len1len1: int==std/core/int/(==): (x : int, y : int) -> boollen2len2: int &&std/core/types/(&&): (x : bool, y : bool) -> bool s1s1: string==std/core/string/(==): (string, string) -> bools2s2: string)
pub fun (!==)std/core/sslice/(!==): (slice1 : sslice, slice2 : sslice) -> bool(slice1slice1: sslice: sslicestd/core/sslice/sslice: V, slice2slice2: sslice: sslicestd/core/sslice/sslice: V )result: -> total bool: boolstd/core/types/bool: V
!std/core/types/bool/(!): (b : bool) -> bool(slice1slice1: sslice===std/core/sslice/(===): (slice1 : sslice, slice2 : sslice) -> boolslice2slice2: sslice)
pub extern countstd/core/sslice/count: (slice : sslice) -> int( sliceslice: sslice : sslicestd/core/sslice/sslice: V ) : intstd/core/types/int: V
c "kk_slice_count"
cs "Primitive.SliceCount"
js "_sslice_count"
extern first1std/core/sslice/first1: (s : string) -> sslice(ss: string : stringstd/core/types/string: V ) : sslicestd/core/sslice/sslice: V
c "kk_slice_first"
cs "Primitive.SliceFirst"
js "_sslice_first"
extern last1std/core/sslice/last1: (s : string) -> sslice(ss: string : stringstd/core/types/string: V ) : sslicestd/core/sslice/sslice: V
c "kk_slice_last"
cs "Primitive.SliceLast"
js "_sslice_last"
pub fun firststd/core/sslice/first: (s : string, n : ? int) -> sslice(ss: string : stringstd/core/types/string: V, nn: ? int : intstd/core/types/int: V = 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001)result: -> total sslice : sslicestd/core/sslice/sslice: V
val sliceslice: sslice = ss: string.first1std/core/sslice/first1: (s : string) -> sslice
if nn: int==std/core/int/(==): (x : int, y : int) -> bool1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001 then sliceslice: sslice else sliceslice: sslice.extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice( nn: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001 )
pub fun laststd/core/sslice/last: (s : string, n : ? int) -> sslice(ss: string : stringstd/core/types/string: V, nn: ? int : intstd/core/types/int: V = 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001)result: -> total sslice : sslicestd/core/sslice/sslice: V
val sliceslice: sslice = ss: string.last1std/core/sslice/last1: (s : string) -> sslice
if nn: int==std/core/int/(==): (x : int, y : int) -> bool1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001 then sliceslice: sslice
else sliceslice: sslice.advancestd/core/sslice/advance: (slice : sslice, count : int) -> sslice(1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001 -std/core/int/(-): (x : int, y : int) -> int nn: int).extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice(nn: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001)
pub fun capitalizestd/core/sslice/capitalize: (s : string) -> string( ss: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V
ss: string.firststd/core/sslice/first: (s : string, n : ? int) -> sslice.stringstd/core/sslice/string: (slice : sslice) -> string.to-upperstd/core/string/to-upper: (s : string) -> string ++std/core/types/(++): (x : string, y : string) -> string ss: string.firststd/core/sslice/first: (s : string, n : ? int) -> sslice.afterstd/core/sslice/after: (slice : sslice) -> sslice.stringstd/core/sslice/string: (slice : sslice) -> string
pub fun slicestd/core/sslice/slice: (s : string) -> sslice( ss: string : stringstd/core/types/string: V )result: -> total sslice : sslicestd/core/sslice/sslice: V
Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000,ss: string.lengthstd/core/sslice/length: (s : string) -> int)
val emptystd/core/sslice/empty: sslice = Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(""literal: string
count= 0,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000)
pub fun is-emptystd/core/sslice/is-empty: (slice : sslice) -> bool( sliceslice: sslice : sslicestd/core/sslice/sslice: V )result: -> total bool : boolstd/core/types/bool: V
!std/core/types/bool/(!): (b : bool) -> boolsliceslice: sslice.lenstd/core/sslice/sslice/len: (sslice : sslice) -> int.is-posstd/core/int/is-pos: (i : int) -> bool
val invalidstd/core/sslice/invalid: sslice = Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(""literal: string
count= 0,-1literal: int
dec = -1
hex8 = 0xFF
bit8 = 0b11111111,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000)
pub fun is-validstd/core/sslice/is-valid: (slice : sslice) -> bool( sliceslice: sslice : sslicestd/core/sslice/sslice: V )result: -> total bool : boolstd/core/types/bool: V
sliceslice: sslice.startstd/core/sslice/sslice/start: (sslice : sslice) -> int >=std/core/int/(>=): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
pub fun is-notemptystd/core/sslice/is-notempty: (slice : sslice) -> bool( sliceslice: sslice : sslicestd/core/sslice/sslice: V )result: -> total bool : boolstd/core/types/bool: V
sliceslice: sslice.lenstd/core/sslice/sslice/len: (sslice : sslice) -> int.is-posstd/core/int/is-pos: (i : int) -> bool
pub fun headstd/core/sslice/head: (s : string) -> string( ss: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V
ss: string.firststd/core/sslice/first: (s : string, n : ? int) -> sslice.stringstd/core/sslice/string: (slice : sslice) -> string
pub fun tailstd/core/sslice/tail: (s : string) -> string( ss: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V
ss: string.firststd/core/sslice/first: (s : string, n : ? int) -> sslice.afterstd/core/sslice/after: (slice : sslice) -> sslice.stringstd/core/sslice/string: (slice : sslice) -> string
inline extern lengthstd/core/sslice/length: (s : string) -> int( s : stringstd/core/types/string: V ) : intstd/core/types/int: V
c inline "kk_string_len_int(#1,kk_context())"
cs inline "#1.Length"
js inline "#1.length"
pub extern common-prefixstd/core/sslice/common-prefix: (s : string, t : string, upto : ? int) -> sslice(ss: string : stringstd/core/types/string: V, tt: string : stringstd/core/types/string: V, ^uptoupto: ? int : intstd/core/types/int: V = -1literal: int
dec = -1
hex8 = 0xFF
bit8 = 0b11111111 ) : sslicestd/core/sslice/sslice: V
c "kk_slice_common_prefix_borrow"
cs "Primitive.SliceCommonPrefix"
js "_sslice_common_prefix"
pub extern advancestd/core/sslice/advance: (slice : sslice, count : int) -> sslice( sliceslice: sslice : sslicestd/core/sslice/sslice: V, ^countcount: int : intstd/core/types/int: V ) : sslicestd/core/sslice/sslice: V
c "kk_slice_advance_borrow"
cs "Primitive.SliceAdvance"
js "_sslice_advance"
pub extern extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice( sliceslice: sslice : sslicestd/core/sslice/sslice: V, ^countcount: int : intstd/core/types/int: V ) : sslicestd/core/sslice/sslice: V
c "kk_slice_extend_borrow"
cs "Primitive.SliceExtend"
js "_sslice_extend"
pub fun beforestd/core/sslice/before: (slice : sslice) -> sslice(sliceslice: sslice : sslicestd/core/sslice/sslice: V)result: -> total sslice : sslicestd/core/sslice/sslice: V
val Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,startstart: int,_len) = sliceslice: sslice
Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000,startstart: int)
pub fun afterstd/core/sslice/after: (slice : sslice) -> sslice(sliceslice: sslice : sslicestd/core/sslice/sslice: V)result: -> total sslice : sslicestd/core/sslice/sslice: V
val Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,startstart: int,lenlen: int) = sliceslice: sslice
Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,startstart: int+std/core/int/(+): (x : int, y : int) -> intlenlen: int,ss: string.lengthstd/core/sslice/length: (s : string) -> int -std/core/int/(-): (x : int, y : int) -> int (startstart: int+std/core/int/(+): (x : int, y : int) -> intlenlen: int))
pub extern stringstd/core/sslice/string: (slice : sslice) -> string( sliceslice: sslice : sslicestd/core/sslice/sslice: V ) : stringstd/core/types/string: V
c "kk_slice_to_string"
cs "Primitive.SliceToString"
js "_slice_to_string"
pub extern nextstd/core/sslice/next: (slice : sslice) -> maybe<(char, sslice)>( sliceslice: sslice : sslicestd/core/sslice/sslice: V ) : maybestd/core/types/maybe: V -> V<(std/core/types/tuple2: (V, V) -> Vcharstd/core/types/char: V,sslicestd/core/sslice/sslice: V)>
c "kk_slice_next"
cs "Primitive.SliceNext"
js "_sslice_next"
pub fun truncatestd/core/sslice/truncate: (slice : sslice) -> sslice( sliceslice: sslice: sslicestd/core/sslice/sslice: V )result: -> total sslice: sslicestd/core/sslice/sslice: V
Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(sliceslice: sslice.strstd/core/sslice/sslice/str: (sslice : sslice) -> string, sliceslice: sslice.startstd/core/sslice/sslice/start: (sslice : sslice) -> int, 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000)
pub fun subslicestd/core/sslice/subslice: (slice : sslice, start : int, end : int) -> sslice( sliceslice: sslice: sslicestd/core/sslice/sslice: V, startstart: int : intstd/core/types/int: V, endend: int : intstd/core/types/int: V )result: -> total sslice: sslicestd/core/sslice/sslice: V
if startstart: int <std/core/int/(<): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000 ||std/core/types/(||): (x : bool, y : bool) -> bool endend: int <std/core/int/(<): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000 then sliceslice: sslice else
sliceslice: sslice.advancestd/core/sslice/advance: (slice : sslice, count : int) -> sslice(startstart: int).truncatestd/core/sslice/truncate: (slice : sslice) -> sslice.extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice(endend: int -std/core/int/(-): (x : int, y : int) -> int startstart: int)
pub fun takestd/core/sslice/take: (slice : sslice, n : int) -> sslice( sliceslice: sslice: sslicestd/core/sslice/sslice: V, nn: int : intstd/core/types/int: V)result: -> total sslice: sslicestd/core/sslice/sslice: V
if nn: int <std/core/int/(<): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000 then sliceslice: sslice else sliceslice: sslice.truncatestd/core/sslice/truncate: (slice : sslice) -> sslice.extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice(nn: int)
pub fun dropstd/core/sslice/drop: (slice : sslice, n : int) -> sslice( sliceslice: sslice: sslicestd/core/sslice/sslice: V, nn: int : intstd/core/types/int: V)result: -> total sslice: sslicestd/core/sslice/sslice: V
if nn: int <=std/core/int/(<=): (x : int, y : int) -> bool 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000 then sliceslice: sslice else sliceslice: sslice.advancestd/core/sslice/advance: (slice : sslice, count : int) -> sslice(nn: int).truncatestd/core/sslice/truncate: (slice : sslice) -> sslice.extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice(sliceslice: sslice.countstd/core/sslice/count: (slice : sslice) -> int -std/core/int/(-): (x : int, y : int) -> int nn: int)
pub fun foreach-whilestd/core/sslice/foreach-while: forall<a,e> (slice : sslice, action : (c : char) -> e maybe<a>) -> e maybe<a>( sliceslice: sslice : sslicestd/core/sslice/sslice: V, actionaction: (c : char) -> $392 maybe<$391> : (c : charstd/core/types/char: V) -> ee: E maybestd/core/types/maybe: V -> V<aa: V> )result: -> 451 maybe<450> : ee: E maybestd/core/types/maybe: V -> V<aa: V>
match sliceslice: sslice.nextstd/core/sslice/next: (slice : sslice) -> $392 maybe<(char, sslice)>
Nothingstd/core/types/Nothing: forall<a> maybe<a> -> Nothingstd/core/types/Nothing: forall<a> maybe<a>
Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>((std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)cc: char,restrest: sslice)std/core/types/Tuple2: forall<a,b> (fst : a, snd : b) -> (a, b)) ->
match actionaction: (c : char) -> $392 maybe<$391>(cc: char)
Nothingstd/core/types/Nothing: forall<a> maybe<a> -> foreach-whilestd/core/sslice/foreach-while: (slice : sslice, action : (c : char) -> $392 maybe<$391>) -> $392 maybe<$391>(pretend-decreasingstd/core/undiv/pretend-decreasing: (x : sslice) -> $392 sslice(restrest: sslice),actionaction: (c : char) -> $392 maybe<$391>)
resres: maybe<$391> -> resres: maybe<$391>
pub fun foreachstd/core/sslice/foreach: forall<e> (slice : sslice, action : (c : char) -> e ()) -> e ()( sliceslice: sslice : sslicestd/core/sslice/sslice: V, actionaction: (c : char) -> $500 () : (c:charstd/core/types/char: V) -> ee: E (std/core/types/unit: V)std/core/types/unit: V)result: -> 528 () : ee: E (std/core/types/unit: V)std/core/types/unit: V
foreach-whilestd/core/sslice/foreach-while: (slice : sslice, action : (c : char) -> $500 maybe<_514>) -> $500 maybe<_514>( sliceslice: sslice ) fnfn: (c : char) -> $500 maybe<_514>(cc: char)
actionaction: (c : char) -> $500 ()(cc: char)
Nothingstd/core/types/Nothing: forall<a> maybe<a>
(std/core/types/Unit: ())std/core/types/Unit: ()
pub fun string/foreach-whilestd/core/sslice/string/foreach-while: forall<a,e> (s : string, action : (c : char) -> e maybe<a>) -> e maybe<a>( ss: string : stringstd/core/types/string: V, actionaction: (c : char) -> $453 maybe<$452> : (c:charstd/core/types/char: V) -> ee: E maybestd/core/types/maybe: V -> V<aa: V> )result: -> 483 maybe<482> : ee: E maybestd/core/types/maybe: V -> V<aa: V>
ss: string.slicestd/core/sslice/slice: (s : string) -> $453 sslice.foreach-whilestd/core/sslice/foreach-while: (slice : sslice, action : (c : char) -> $453 maybe<$452>) -> $453 maybe<$452>(actionaction: (c : char) -> $453 maybe<$452>)
pub fun string/foreachstd/core/sslice/string/foreach: forall<e> (s : string, action : (c : char) -> e ()) -> e ()( ss: string : stringstd/core/types/string: V, actionaction: (c : char) -> $532 () : (c:charstd/core/types/char: V) -> ee: E (std/core/types/unit: V)std/core/types/unit: V )result: -> 551 () : ee: E (std/core/types/unit: V)std/core/types/unit: V
ss: string.slicestd/core/sslice/slice: (s : string) -> $532 sslice.foreachstd/core/sslice/foreach: (slice : sslice, action : (c : char) -> $532 ()) -> $532 ()(actionaction: (c : char) -> $532 ())
pub fun head-charstd/core/sslice/head-char: (s : string) -> maybe<char>( ss: string : stringstd/core/types/string: V )result: -> total maybe<char> : maybestd/core/types/maybe: V -> V<charstd/core/types/char: V>
ss: string.foreach-whilestd/core/sslice/string/foreach-while: (s : string, action : (c : char) -> maybe<char>) -> maybe<char>( Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> )
pub fun pred/countstd/core/sslice/pred/count: forall<e> (s : string, pred : (char) -> e bool) -> e int( ss: string : stringstd/core/types/string: V, predpred: (char) -> $555 bool : (charstd/core/types/char: V) -> ee: E boolstd/core/types/bool: V )result: -> 658 int : ee: E intstd/core/types/int: V
var cntcnt: local-var<$564,int> := 0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000
ss: string.foreachstd/core/sslice/string/foreach: (s : string, action : (c : char) -> <local<$564>|$555> ()) -> <local<$564>|$555> () fnfn: (c : char) -> <local<$564>|$555> ()(cc: char)
if (mask<local_1: H>{predpred: (char) -> $555 bool(cc: char)}) then cntcnt: local-var<$564,int> :=std/core/types/local-set: (v : local-var<$564,int>, assigned : int) -> <local<$564>|$555> () cntcnt: int+std/core/int/(+): (x : int, y : int) -> <local<$564>|$555> int1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001
cntcnt: int
inline extern xindex-ofstd/core/sslice/xindex-of: (s : string, sub : string) -> ssize_t(s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : ssize_tstd/core/types/ssize_t: V
c inline "kk_string_index_of1(#1,#2,kk_context())"
cs inline "((#1).IndexOf(#2) + 1)"
js inline "((#1).indexOf(#2) + 1)"
pub fun findstd/core/sslice/find: (s : string, sub : string) -> maybe<sslice>( ss: string : stringstd/core/types/string: V, subsub: string : stringstd/core/types/string: V )result: -> total maybe<sslice> : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice/sslice: V>
val ii: int = ss: string.xindex-ofstd/core/sslice/xindex-of: (s : string, sub : string) -> ssize_t(subsub: string).intstd/core/int/ssize_t/int: (i : ssize_t) -> int
if ii: int.is-zerostd/core/int/is-zero: (x : int) -> bool then Nothingstd/core/types/Nothing: forall<a> maybe<a> else Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,ii: int.decstd/core/int/dec: (i : int) -> int,subsub: string.lengthstd/core/sslice/length: (s : string) -> int))
inline extern xlast-index-ofstd/core/sslice/xlast-index-of: (s : string, sub : string) -> ssize_t(s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : ssize_tstd/core/types/ssize_t: V
c inline "kk_string_last_index_of1(#1,#2,kk_context())"
cs inline "(#1.LastIndexOf(#2) + 1)"
js inline "((#1).lastIndexOf(#2) + 1)"
pub fun find-laststd/core/sslice/find-last: (s : string, sub : string) -> maybe<sslice>( ss: string : stringstd/core/types/string: V, subsub: string : stringstd/core/types/string: V )result: -> total maybe<sslice> : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice/sslice: V>
val ii: int = ss: string.xlast-index-ofstd/core/sslice/xlast-index-of: (s : string, sub : string) -> ssize_t(subsub: string).intstd/core/int/ssize_t/int: (i : ssize_t) -> int
if ii: int.is-zerostd/core/int/is-zero: (x : int) -> bool then Nothingstd/core/types/Nothing: forall<a> maybe<a> else Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,ii: int.decstd/core/int/dec: (i : int) -> int,subsub: string.lengthstd/core/sslice/length: (s : string) -> int))
inline extern xstarts-withstd/core/sslice/xstarts-with: (s : string, pre : string) -> bool: (s : stringstd/core/types/string: V, pre : stringstd/core/types/string: V ) -> boolstd/core/types/bool: V
c "kk_string_starts_with"
cs inline "#1.StartsWith(#2)"
js inline "(#1.substr(0,#2.length) === #2)"
pub fun starts-withstd/core/sslice/starts-with: (s : string, pre : string) -> maybe<sslice>( ss: string : stringstd/core/types/string: V, prepre: string : stringstd/core/types/string: V )result: -> total maybe<sslice> : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice/sslice: V>
if xstarts-withstd/core/sslice/xstarts-with: (s : string, pre : string) -> bool(ss: string,prepre: string)
then Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,prepre: string.lengthstd/core/sslice/length: (s : string) -> int,ss: string.lengthstd/core/sslice/length: (s : string) -> int -std/core/int/(-): (x : int, y : int) -> int prepre: string.lengthstd/core/sslice/length: (s : string) -> int))
else Nothingstd/core/types/Nothing: forall<a> maybe<a>
extern xends-withstd/core/sslice/xends-with: (s : string, post : string) -> bool: (s : stringstd/core/types/string: V, post : stringstd/core/types/string: V ) -> boolstd/core/types/bool: V
c "kk_string_ends_with"
cs inline "#1.EndsWith(#2)"
js inline "((#1).indexOf(#2, (#1).length - (#2).length) !== -1)"
pub fun ends-withstd/core/sslice/ends-with: (s : string, post : string) -> maybe<sslice>( ss: string : stringstd/core/types/string: V, postpost: string : stringstd/core/types/string: V )result: -> total maybe<sslice> : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice/sslice: V>
if (xends-withstd/core/sslice/xends-with: (s : string, post : string) -> bool(ss: string,postpost: string))
then Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(Sslicestd/core/sslice/Sslice: (str : string, start : int, len : int) -> sslice(ss: string,0literal: int
dec = 0
hex8 = 0x00
bit8 = 0b00000000,ss: string.lengthstd/core/sslice/length: (s : string) -> int -std/core/int/(-): (x : int, y : int) -> int postpost: string.lengthstd/core/sslice/length: (s : string) -> int))
else Nothingstd/core/types/Nothing: forall<a> maybe<a>
pub fun string/truncatestd/core/sslice/string/truncate: (s : string, count : int) -> string( ss: string : stringstd/core/types/string: V, countcount: int : intstd/core/types/int: V )result: -> total string : stringstd/core/types/string: V
ss: string.firststd/core/sslice/first: (s : string, n : ? int) -> sslice.extendstd/core/sslice/extend: (slice : sslice, count : int) -> sslice(countcount: int -std/core/int/(-): (x : int, y : int) -> int 1literal: int
dec = 1
hex8 = 0x01
bit8 = 0b00000001).stringstd/core/sslice/string: (slice : sslice) -> string
pub fun trim-leftstd/core/sslice/trim-left: (s : string, sub : string) -> string( ss: string : stringstd/core/types/string: V, subsub: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V
if subsub: string.is-emptystd/core/string/is-empty: (s : string) -> bool returnreturn: string ss: string
match ss: string.starts-withstd/core/sslice/starts-with: (s : string, pre : string) -> maybe<sslice>(subsub: string)
Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(sliceslice: sslice) -> trim-leftstd/core/sslice/trim-left: (s : string, sub : string) -> string(pretend-decreasingstd/core/undiv/pretend-decreasing: (x : string) -> string(sliceslice: sslice.stringstd/core/sslice/string: (slice : sslice) -> string),subsub: string)
Nothingstd/core/types/Nothing: forall<a> maybe<a> -> ss: string
pub fun trim-rightstd/core/sslice/trim-right: (s : string, sub : string) -> string( ss: string : stringstd/core/types/string: V, subsub: string : stringstd/core/types/string: V )result: -> total string : stringstd/core/types/string: V
if subsub: string.is-emptystd/core/string/is-empty: (s : string) -> bool returnreturn: string ss: string
match ss: string.ends-withstd/core/sslice/ends-with: (s : string, post : string) -> maybe<sslice>(subsub: string)
Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(sliceslice: sslice) -> trim-rightstd/core/sslice/trim-right: (s : string, sub : string) -> string(pretend-decreasingstd/core/undiv/pretend-decreasing: (x : string) -> string(sliceslice: sslice.stringstd/core/sslice/string: (slice : sslice) -> string),subsub: string)
Nothingstd/core/types/Nothing: forall<a> maybe<a> -> ss: string