tlang-interperter-cs/tlanglib/TString.cs

29 lines
579 B
C#
Raw Normal View History

2023-06-08 18:14:35 +00:00
using Newtonsoft.Json.Linq;
2023-03-09 19:40:14 +00:00
namespace tlang
{
public class TString : TObject
{
2023-06-08 18:14:35 +00:00
public static implicit operator string(TString s)
{
return s.Value;
}
2023-03-09 19:40:14 +00:00
public string Value {get;set;}
2023-03-09 23:57:16 +00:00
public override bool AsBoolean => Value.Length > 0;
2023-03-09 19:40:14 +00:00
public TString(string text)
{
Value = text;
}
public override string ToString()
{
return Value;
}
2023-06-08 18:14:35 +00:00
public override JToken AsToken()
{
return JValue.FromObject(Value);
}
2023-03-09 19:40:14 +00:00
}
}