本文整理汇总了C#中INakoFuncCallInfo.StackPopAsInt方法的典型用法代码示例。如果您正苦于以下问题:C# INakoFuncCallInfo.StackPopAsInt方法的具体用法?C# INakoFuncCallInfo.StackPopAsInt怎么用?C# INakoFuncCallInfo.StackPopAsInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INakoFuncCallInfo
的用法示例。
在下文中一共展示了INakoFuncCallInfo.StackPopAsInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _right
/// <summary>
/// 右から部分文字列を返す
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _right(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
int len = (int)info.StackPopAsInt();
return s.Substring(s.Length-len);
}
示例2: _zeroFill
/// <summary>
/// ゼロ埋め
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _zeroFill(INakoFuncCallInfo info)
{
long s = info.StackPopAsInt();
string l = info.StackPopAsInt().ToString();
return String.Format(@"{0:D"+l+"}",s);
}
示例3: _remove
private object _remove(INakoFuncCallInfo info)
{
object sr = info.StackPop();
int a = NadesikoPositionToCSPosition((int)info.StackPopAsInt());
int b = (int)info.StackPopAsInt();
object s = ((NakoVariable)sr).Body;
object ret;
if(s is string){
ret = ((string)s).Remove(a,b);
}else{
ret = null;
}
((NakoVariable)sr).SetBodyAutoType(ret);
return null;
}
示例4: _removeright
private object _removeright(INakoFuncCallInfo info)
{
object sr = info.StackPop();
int a = (int)info.StackPopAsInt();
object s = ((NakoVariable)sr).Body;
object ret;
if(s is string){
string _tmp = (string)s;
ret = _tmp.Remove(_tmp.Length - a);
}else{
ret = null;
}
((NakoVariable)sr).SetBodyAutoType(ret);
return null;
}
示例5: _insert
private object _insert(INakoFuncCallInfo info)
{
StringBuilder s = new StringBuilder(info.StackPopAsString());
int cnt = NadesikoPositionToCSPosition((int)info.StackPopAsInt());
string a = info.StackPopAsString();
return s.Insert(cnt,a).ToString();
}
示例6: _left
/// <summary>
/// 左からN文字の部分文字列
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _left(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
int len = (int)info.StackPopAsInt();
return s.Substring(0,len);
}
示例7: _search
private object _search(INakoFuncCallInfo info)
{
object ar = info.StackPop();
int i = (int)info.StackPopAsInt();
object key = info.StackPop();
if (!(ar is NakoVarArray))
{
throw new NakoPluginRuntimeException("『検索』の引数が配列ではありません");
}
NakoVarArray arr = (NakoVarArray)ar;
while(arr.GetValue(i)!=null){
object var = arr.GetValue(i);
if(var.ToString()==key.ToString()){
return i;
}
i++;
}
return -1;
}
示例8: _extract
/// <summary>
/// 文字抜き出す
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private object _extract(INakoFuncCallInfo info)
{
string s = info.StackPopAsString();
int a = NadesikoPositionToCSPosition((int)info.StackPopAsInt());
int cnt = (int)info.StackPopAsInt();
return s.Substring(a,cnt);
}
示例9: _insertArray
private object _insertArray(INakoFuncCallInfo info)
{
object obj_base = info.StackPop(); // 参照渡しなので変数への参照が得られる
int i = (int)info.StackPopAsInt();
object obj_insert = info.StackPop();
if (!(obj_base is NakoVariable))
{
throw new NakoPluginRuntimeException("『配列一括挿入』の元配列がvariableではありません");
}
NakoVarArray array_insert = new NakoVarArray();
if (obj_insert is NakoVariable)
{
NakoVariable var_insert = (NakoVariable)obj_insert;
if(var_insert.Body is NakoVarArray){
array_insert = (NakoVarArray)var_insert.Body;
}
}else if(obj_insert is string){
array_insert.SetValuesFromString((string)obj_insert);
}else{
throw new NakoPluginRuntimeException("『配列一括挿入』の挿入配列がvariableではありません");
}
NakoVariable var_base = (NakoVariable)obj_base;
if(var_base.Body is NakoVarArray){
NakoVarArray array_base = (NakoVarArray)var_base.Body;
while(array_insert.Count>0){
NakoVariable variable = array_insert.Pop();
array_base.Insert(i,variable);
}
}
return null;
}
示例10: _removeAt
private object _removeAt(INakoFuncCallInfo info)
{
object a = info.StackPop();
long i = info.StackPopAsInt();
if (!(a is NakoVariable))
{
throw new NakoPluginRuntimeException("『削除』の引数が変数ではありません");
}
NakoVariable av = (NakoVariable)a;
NakoVarArray a_body = null;
// 配列でなければ配列に強制変換する
if (!(av.Body is NakoVarArray))
{
a_body = info.CreateArray();
a_body.SetValuesFromString(av.Body.ToString());
av.SetBody(a_body, NakoVarType.Array);
}
else
{
a_body = (NakoVarArray)av.Body;
}
// 要素を削除する
a_body.RemoveAt((int)i);
// 結果をセット
return null;
}
示例11: _cin
/// <summary>
/// 標準入力取得
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public object _cin(INakoFuncCallInfo info)
{
long count = info.StackPopAsInt();
//TODO:標準入力の取得方法が効率が悪い
long i = 0;
string r = "";
while (i < count)
{
int ch = System.Console.Read();
if (ch < 0) break;
r += (char)ch;
i++;
}
return r;
}
示例12: _to_int
public object _to_int(INakoFuncCallInfo info)
{
return info.StackPopAsInt();
}
示例13: _unixtime_to_datetime
public object _unixtime_to_datetime(INakoFuncCallInfo info)
{
long unixtime = info.StackPopAsInt();
return UnixEpoch.AddSeconds(unixtime).ToLocalTime();
}
示例14: _random
private object _random(INakoFuncCallInfo info)
{
long range = info.StackPopAsInt();
if (_randObj == null) {
_randObj = new Random();
}
int v = _randObj.Next((int)range);
return (long)v;
}
示例15: _intVal
private object _intVal(INakoFuncCallInfo info)
{
return info.StackPopAsInt();
}