tlang-runtime-compiler/TLang.VM/TString.cs

34 lines
803 B
C#

using System.Collections.Generic;
namespace TLang.VM
{
public class TString : TObject
{
public override string Type => "string";
public override bool True => !string.IsNullOrWhiteSpace(Value);
public string Value {get;set;}
public IEnumerable<TObject> GetObjects()
{
foreach(var item in Value)
{
yield return new TChar(item);
}
}
public IEnumerable<TObject> GetChars()
{
foreach(var item in Value)
{
yield return new TChar(item);
}
}
public TString(string value)
{
this.Value = value;
}
public override string ToString()
{
return Value;
}
}
}