Skip to content

Commit ee34d56

Browse files
committed
string to char array and len()
1 parent 91694ca commit ee34d56

13 files changed

Lines changed: 7 additions & 2 deletions
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

7Sharp/Intrerpreter/Sysfunctions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ internal static void Init(ref Interpreter interpreter)
3737
Interpreter.functions.Add("bgColor", new _7sFunction("bgColor", 1, new Action<dynamic>(BgColor)));
3838
Interpreter.functions.Add("clear", new _7sFunction("clear", 0, new Action(Clear)));
3939
Interpreter.functions.Add("wait", new _7sFunction("wait", 1, new Action<int>(Wait)));
40+
Interpreter.functions.Add("len", new _7sFunction("len", 1, new Func<object, int>(Len)));
41+
Interpreter.functions.Add("chars", new _7sFunction("chars", 1, new Func<string, char[]>(Chars)));
4042
}
4143
#region main
44+
static char[] Chars(string s) => s.ToCharArray();
45+
46+
static int Len(object v) => (v == null || (!v.GetType().IsSubclassOf(typeof(Array)) && v.GetType() != typeof(string))) ? -1 : (v.GetType().IsSubclassOf(typeof(Array)) ? ((Array)v).Length : ((string)v).Length);
47+
4248
static void Wait(int ms) => System.Threading.Thread.Sleep(ms);
4349

4450
static void ClearConsole() => Clear();

7Sharp/obj/Debug/7Sharp.exe

512 Bytes
Binary file not shown.

7Sharp/obj/Debug/7Sharp.pdb

0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
44283536b2413e42d1df6b7b7d201657e6691ed2
1+
cba8862508fa62f511f279c960ee6345387f2bc3

7Sharp/obj/Release/7Sharp.csproj.FileListAbsolute.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ C:\Users\Techcraft7\Source\7Sharp\7Sharp\bin\Release\System.Memory.xml
3535
C:\Users\Techcraft7\Source\7Sharp\7Sharp\bin\Release\System.Numerics.Vectors.xml
3636
C:\Users\Techcraft7\Source\7Sharp\7Sharp\bin\Release\System.Runtime.CompilerServices.Unsafe.xml
3737
C:\Users\Techcraft7\Source\7Sharp\7Sharp\bin\Release\System.ValueTuple.xml
38-
C:\Users\Techcraft7\Source\7Sharp\7Sharp\bin\Release\Techcraft7 DLL Pack.pdb
3938
C:\Users\Techcraft7\Source\7Sharp\7Sharp\obj\Release\7Sharp.csprojAssemblyReference.cache
4039
C:\Users\Techcraft7\Source\7Sharp\7Sharp\obj\Release\_7Sharp.Editor.Editor.resources
4140
C:\Users\Techcraft7\Source\7Sharp\7Sharp\obj\Release\7Sharp.csproj.GenerateResource.cache
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)