@@ -255,6 +255,43 @@ public static DynValue sub(ScriptExecutionContext executionContext, CallbackArgu
255255
256256 return DynValue . NewString ( s ) ;
257257 }
258+
259+ [ MoonSharpModuleMethod ]
260+ public static DynValue startsWith ( ScriptExecutionContext executionContext , CallbackArguments args )
261+ {
262+ DynValue arg_s1 = args . AsType ( 0 , "startsWith" , DataType . String , true ) ;
263+ DynValue arg_s2 = args . AsType ( 1 , "startsWith" , DataType . String , true ) ;
264+
265+ if ( arg_s1 . IsNil ( ) || arg_s2 . IsNil ( ) )
266+ return DynValue . False ;
267+
268+ return DynValue . NewBoolean ( arg_s1 . String . StartsWith ( arg_s2 . String ) ) ;
269+ }
270+
271+ [ MoonSharpModuleMethod ]
272+ public static DynValue endsWith ( ScriptExecutionContext executionContext , CallbackArguments args )
273+ {
274+ DynValue arg_s1 = args . AsType ( 0 , "endsWith" , DataType . String , true ) ;
275+ DynValue arg_s2 = args . AsType ( 1 , "endsWith" , DataType . String , true ) ;
276+
277+ if ( arg_s1 . IsNil ( ) || arg_s2 . IsNil ( ) )
278+ return DynValue . False ;
279+
280+ return DynValue . NewBoolean ( arg_s1 . String . EndsWith ( arg_s2 . String ) ) ;
281+ }
282+
283+ [ MoonSharpModuleMethod ]
284+ public static DynValue contains ( ScriptExecutionContext executionContext , CallbackArguments args )
285+ {
286+ DynValue arg_s1 = args . AsType ( 0 , "contains" , DataType . String , true ) ;
287+ DynValue arg_s2 = args . AsType ( 1 , "contains" , DataType . String , true ) ;
288+
289+ if ( arg_s1 . IsNil ( ) || arg_s2 . IsNil ( ) )
290+ return DynValue . False ;
291+
292+ return DynValue . NewBoolean ( arg_s1 . String . Contains ( arg_s2 . String ) ) ;
293+ }
294+
258295 }
259296
260297
0 commit comments