@@ -257,10 +257,24 @@ macro initStandardLibrary() =
257
257
boolNode.bVal = re.match (args[0 ].value.sVal, re (args[1 ].value.sVal))
258
258
boolNode
259
259
260
+ template strStartsWithStream =
261
+ let boolNode = ast.newNode (ntLitBool)
262
+ if args[1 ].value.streamContent.kind == JString :
263
+ boolNode.bVal = strutils.startsWith (args[0 ].value.sVal, args[1 ].value.streamContent.str)
264
+ boolNode
265
+
266
+ template strStreamStartsWith =
267
+ let boolNode = ast.newNode (ntLitBool)
268
+ if args[0 ].value.streamContent.kind == JString :
269
+ boolNode.bVal = strutils.startsWith (args[0 ].value.streamContent.str, args[1 ].value.sVal)
270
+ boolNode
271
+
260
272
let
261
273
fnStrings = @ [
262
274
fwd (" endsWith" , ntLitBool, [(ntLitString, " s" ), (ntLitString, " suffix" )]),
263
275
fwd (" startsWith" , ntLitBool, [(ntLitString, " s" ), (ntLitString, " prefix" )]),
276
+ fwd (" startsWith" , ntLitBool, [(ntLitString, " s" ), (ntStream, " prefix" )], wrapper = getAst (strStartsWithStream ())),
277
+ fwd (" startsWith" , ntLitBool, [(ntStream, " s" ), (ntLitString, " prefix" )], wrapper = getAst (strStreamStartsWith ())),
264
278
fwd (" capitalizeAscii" , ntLitString, [(ntLitString, " s" )], " capitalize" ),
265
279
fwd (" replace" , ntLitString, [(ntLitString, " s" ), (ntLitString, " sub" ), (ntLitString, " by" )]),
266
280
fwd (" toLowerAscii" , ntLitString, [(ntLitString, " s" )], " toLower" ),
0 commit comments