本文整理汇总了C#中KacTalk.ktString.AsLower方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.AsLower方法的具体用法?C# ktString.AsLower怎么用?C# ktString.AsLower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktString
的用法示例。
在下文中一共展示了ktString.AsLower方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _RunMethod
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
switch (Name.AsLower())
{
case "run":
case "_run":
case "execute":
case "_execute":
case "_func_call":
{
Value = Run( Arguments );
break;
}
default:
{
throw new ktError("Couldn't find the method '" +
Name + "' in class '" + m_Name + "'.", ktERR._404);
}
}
return Value;
}
示例2: ToType
public object ToType(ktString Type)
{
if (m_Object == null)
{
return null;
}
try
{
ktClass Class = (ktClass)m_Object;
return Class.RunMethod("To" + Type).ToType(Type);
}
catch (Exception)
{
}
switch (Type.AsLower())
{
case "bool":
{
if (m_Object.GetType() == typeof(bool))
{
return m_Object;
}
else if (m_Object.GetType() == typeof(int))
{
return ((int)m_Object) != 0;
}
else if (m_Object.GetType() == typeof(float))
{
return ((float)m_Object) != 0.0f;
}
else if (m_Object.GetType() == typeof(double))
{
return ((double)m_Object) != 0.0;
}
else if (m_Object.GetType() == typeof(char))
{
return ((char)m_Object) != 0;
}
else if (m_Object.GetType() == typeof(string))
{
return ((string)m_Object) != "false";
}
else if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object) != "false";
}
else if (m_Object.GetType() == typeof(ktList))
{
return !((ktList)m_Object).IsEmpty();
}
else
{
return m_Object.ToString() != "false";
}
}
case "int":
case "integer":
{
try
{
if (m_Object.GetType() == typeof(bool))
{
return (((bool)m_Object) ? 1 : 0);
}
else if (m_Object.GetType() == typeof(int))
{
return m_Object;
}
else if (m_Object.GetType() == typeof(float))
{
return (int)((float)m_Object);
}
else if (m_Object.GetType() == typeof(double))
{
return (int)((double)m_Object);
}
else if (m_Object.GetType() == typeof(char))
{
return (int)((char)m_Object);
}
else if (m_Object.GetType() == typeof(string))
{
return Convert.ToInt32(((string)m_Object));
}
else if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object).ToInt();
}
else
{
return Convert.ToInt32(m_Object.ToString());
}
}
catch (Exception Err)
{
if (Err.GetType() == typeof(System.FormatException))
{
//.........这里部分代码省略.........
示例3: _RunMethod
/// <summary>
/// Run a method
/// </summary>
/// <param name="Name"></param>
/// <param name="Arguments"></param>
/// <returns></returns>
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
//ktDebug.Log("ktInt::" + Name);
// Check the name of the method to call and call appropriate method
switch (Name.AsLower())
{
case "_add":
case "op+":
case "operator+":
{
Value = _Add(Arguments);
break;
}
case "add":
case "op+=":
case "operator+=":
case "_append":
{
CheckIfConstant(Name);
Value = Add(Arguments);
break;
}
case "increase":
case "op++":
case "operator++":
case "_increase":
{
CheckIfConstant(Name);
Value = Increase();
break;
}
case "_subtract":
case "op-":
case "operator-":
{
Value = _Subtract(Arguments);
break;
}
case "op-=":
case "operator-=":
case "subtract":
{
CheckIfConstant(Name);
Value = Subtract(Arguments);
break;
}
case "decrease":
case "op--":
case "operator--":
case "_decrease":
{
CheckIfConstant(Name);
Value = Decrease();
break;
}
case "_multiply":
case "_times":
case "op*":
case "operator*":
{
Value = _Multiply(Arguments);
break;
}
case "multiply":
case "times":
case "op*=":
case "operator*=":
{
CheckIfConstant(Name);
Value = Multiply(Arguments);
break;
}
case "_divide":
case "op/":
case "operator/":
{
Value = _Divide(Arguments);
break;
}
case "op/=":
case "operator/=":
case "divide":
{
CheckIfConstant(Name);
Value = Divide(Arguments);
break;
}
case "_mod":
case "_modulus":
case "op%":
case "operator%":
//.........这里部分代码省略.........
示例4: Compare
/// <summary>
/// Compare the integer with the given value
/// </summary>
/// <param name="op">The operator to use for the comparison</param>
/// <param name="val">The value to compare with</param>
/// <returns>A value representing the comparison</returns>
public override int Compare(ktString op, ktValue val)
{
int ret = 0;
// Get the value as an integer
int iVal = GetAsInt(val);
// Check which operator we should use
switch ( op.AsLower() )
{
case ">":
case "op>":
case "operator>":
case "mt":
case "gt":
case "greater":
case "greaterthan":
case "more":
case "morethan":
case "isgreater":
case "isgreaterthan":
case "ismore":
case "ismorethan":
{
ret = (m_value > iVal) ? 1 : 0;
break;
}
case ">=":
case "op>=":
case "operator>=":
case "mte":
case "gte":
case "greaterorequal":
case "greaterthanorequal":
case "moreorequal":
case "morethanorequal":
case "isgreaterorequal":
case "isgreaterthanorequal":
case "ismoreorequal":
case "ismorethanorequal":
{
ret = (m_value >= iVal) ? 1 : 0;
break;
}
case "<":
case "op<":
case "operator<":
case "lt":
case "less":
case "lessthan":
case "isless":
case "islessthan":
{
ret = (m_value < iVal) ? 1 : 0;
break;
}
case "<=":
case "op<=":
case "operator<=":
case "lte":
case "lessorequal":
case "lessthanorequal":
case "islessorequal":
case "islessthanorequal":
{
ret = (m_value <= iVal) ? 1 : 0;
break;
}
case "<>":
case "!=":
case "op<>":
case "op!=":
case "operator<>":
case "operator!=":
case "ne":
case "isnotequal":
case "notequal":
{
ret = (m_value != iVal) ? 1 : 0;
break;
}
case "==":
case "op==":
case "operator==":
case "isequal":
case "equal":
case "eq":
{
ret = (m_value == iVal) ? 1 : 0;
break;
}
case "compare":
{
ret = m_value.CompareTo(iVal);
break;
//.........这里部分代码省略.........
示例5: RunMethod
public ktValue RunMethod(ktString Name, ktList Arguments)
{
if (Name.IsEmpty())
{
throw new ktError("Didn't get the name of the method to run in class '" +
m_Name + "'.", ktERR.NOTSET);
}
ktDebug.Log("RunM Arg:" + Arguments.Get_R());
ktValue Value = ktValue.Null;
//ktDebug.Log( "ktClass::RM( " + Name + " );" );
try
{
Value = _RunMethod(Name, Arguments);
}
catch (Exception Err)
{
Value = (ktValue)Arguments.First.Node.Value;
if (Name == "Export")
{
return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", Export()), true, true);
}
else if (Name.AsLower() == "tostring")
{
return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", ToString()), true, true);
}
else if (Name.AsLower() == "operator~")
{
return new ktValue("", "ktString", kacTalk.Main.MakeObjectOf("ktString", ToString() + Value.ToString()), true, true);
}
else if (Name.AsLower().StartsWith("to", out Name))
{
}
throw Err;
}
return Value;
}
示例6: GetProperty
public ktValue GetProperty(ktString Name, bool Copy)
{
ktValue Value = ktValue.Null;
if (Name.IsEmpty())
{
return Value;
}
//ktDebug.Log( "GetProperty( " + Name + " )" );
switch (Name.AsLower())
{
case "as_class":
case "class":
{
return new ktValue(Name, "ktClass", CreateClass(), true, true);
}
default:
{
//ktDebug.Log( "Default" );
Value = _GetProperty(Name, Copy);
break;
}
}
//ktDebug.Log( "Val = " + ((Value == null) ? "NULL" : Value.ToString() ) + " )" );
return Value;
}
示例7: GetMember
public virtual ktValue GetMember(ktString Name)
{
ktValue Value = ktValue.Null;
try
{
Value = GetProperty(Name);
//ktDebug.Log( "GM::P V:" + Value.ToString() + ";" );
if (!Value.IsNull())
{
return Value;
}
}
catch (Exception)
{
//ktDebug.Log( "Err:" + E.ToString() + ";" );
}
try
{
ktFunction Func = GetMethod(Name);
Value = new ktValue(Name, "ktFunction", Func, true, true);
if (!Value.IsNull())
{
return Value;
}
}
catch (Exception)
{
if (Name == "Export")
{
ktDelegateFunction Func = new ktDelegateFunction("Export", ExportValue);
Value = new ktValue(Name, "ktFunction", Func, true, true);
if (!Value.IsNull())
{
return Value;
}
}
else if (Name.AsLower() == "tostring")
{
ktDelegateFunction Func = new ktDelegateFunction("ToString", ToStringValue);
Value = new ktValue(Name, "ktFunction", Func, true, true);
if (!Value.IsNull())
{
return Value;
}
}
}
throw new ktError("Can't find the member '" + Name + "' in class '" + m_Name + "'!", ktERR._404);
}
示例8: PrepBaseURL
private ktString PrepBaseURL(ktString URL)
{
if (!URL.AsLower().StartsWith("http://"))
{
URL = "http://" + URL;
}
if ( m_UseQuery )
{
URL += "?kuery=";
}
return URL;
}
示例9: _RunMethod
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
switch (Name.AsLower())
{
case "_add":
case "op+":
case "operator+":
case "add":
{
Value = Add(Arguments);
break;
}
}
return Value;
}
示例10: ToType
public object ToType(ktString Type)
{
if (m_Object == null)
{
return null;
}
#if Debug
ktDebug.Log( "ktValue::ToType( " + m_Object.GetType().ToString() + " )" );
#endif
try
{
ktClass Class = (ktClass)m_Object;
ktValue v = Class.RunMethod("To" + Type);
object o = v.ToType(Type);
return o;
}
catch (Exception E)
{
#if Debug
ktDebug.Log( E.ToString() + ";;;;;;;" + E.StackTrace.ToString() );
#endif
}
if ((m_Object.GetType() == typeof(ktObjectWrapper)) ||
(m_Object.GetStringType() == "ktObjectWrapper"))
{
return ((ktObjectWrapper)m_Object).ToType(Type);
}
switch (Type.AsLower())
{
case "bool":
{
if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object).AsLower() != "false";
}
else if (m_Object.GetType() == typeof(ktList))
{
return !((ktList)m_Object).IsEmpty();
}
else
{
return m_Object.ToString().ToLower() != "false";
}
}
case "int":
case "integer":
{
try
{
if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object).ToInt();
}
else
{
return Convert.ToInt32(m_Object.ToString());
}
}
catch (Exception Err)
{
if (Err.GetType() == typeof(System.FormatException))
{
throw new ktError("ktValue::ToType: Cant make '" + Value + "' into an integer", ktERR.WRONGTYPE);
}
else
{
throw Err;
}
}
}
case "float":
{
try
{
if (m_Object.GetType() == typeof(ktString))
{
return ((ktString)m_Object).ToFloat();
}
else
{
return Convert.ToSingle(m_Object.ToString());
}
}
catch (Exception Err)
{
if (Err.GetType() == typeof(System.FormatException))
{
throw new ktError("ktValue::ToType: Cant make '" + Name + "' into an " + Type, ktERR.WRONGTYPE);
}
else
{
throw Err;
}
}
}
case "double":
{
//.........这里部分代码省略.........
示例11: CreateObject
public override ktClass CreateObject(ktString Value)
{
return new ktBool(Value.AsLower() != "false");
}
示例12: _RunMethod
public override ktValue _RunMethod(ktString Name, ktList Arguments)
{
ktValue Value = ktValue.Null;
switch (Name.AsLower())
{
case "!":
case "not":
case "_not":
case "op!":
case "operator!":
{
Value = _Not();
break;
}
case "&&":
case "and":
case "_and":
case "op&&":
case "operator&&":
{
// Value = _And(Arguments);
break;
}
case ">":
case "op>":
case "operator>":
case "mt":
case "gt":
case "greater":
case "greaterthan":
case "more":
case "morethan":
case "isgreater":
case "isgreaterthan":
case "ismore":
case "ismorethan":
case ">=":
case "op>=":
case "operator>=":
case "mte":
case "gte":
case "greaterorequal":
case "greaterthanorequal":
case "moreorequal":
case "morethanorequal":
case "isgreaterorequal":
case "isgreaterthanorequal":
case "ismoreorequal":
case "ismorethanorequal":
case "<":
case "op<":
case "operator<":
case "lt":
case "less":
case "lessthan":
case "isless":
case "islessthan":
case "<=":
case "op<=":
case "operator<=":
case "lte":
case "lessorequal":
case "lessthanorequal":
case "islessorequal":
case "islessthanorequal":
case "<>":
case "!=":
case "op<>":
case "op!=":
case "operator<>":
case "operator!=":
case "ne":
case "isnotequal":
case "notequal":
case "==":
case "op==":
case "operator==":
case "isequal":
case "equal":
case "eq":
{
Value = _Compare(Name, Arguments);
break;
}
default:
{
throw new ktError("Couldn't find the method '" +
Name + "' in class '" + m_Name + "'.", ktERR._404);
}
}
return Value;
}
示例13: CmpNoCase
// Compare the string with 'Str' (ref. strcmp) (case-sensitive)
public int CmpNoCase(ktString Str)
{
return String.Compare(Str.AsLower().GetValue(), AsLower().GetValue());
}