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

34 lines
803 B
C#
Raw Permalink Normal View History

2023-07-30 07:55:10 +00:00
using System.Collections.Generic;
2023-07-29 00:11:09 +00:00
namespace TLang.VM
{
public class TString : TObject
{
2023-07-30 07:55:10 +00:00
public override string Type => "string";
public override bool True => !string.IsNullOrWhiteSpace(Value);
2023-07-29 00:11:09 +00:00
public string Value {get;set;}
2023-07-30 07:55:10 +00:00
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);
}
}
2023-07-29 00:11:09 +00:00
public TString(string value)
{
this.Value = value;
}
2023-07-30 07:55:10 +00:00
public override string ToString()
{
return Value;
}
2023-07-29 00:11:09 +00:00
}
}