本文整理汇总了C#中KacTalk.ktString.Replace方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.Replace方法的具体用法?C# ktString.Replace怎么用?C# ktString.Replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktString
的用法示例。
在下文中一共展示了ktString.Replace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ktDelegateFunction
public ktDelegateFunction(ktString Name, ktFunction_Double_Delegate Delegate)
: base(Name, null, null, ktValue.Null)
{
m_Arguments = new ktList();
m_Arguments.Add(new ktValue("D", "double",
kacTalk.Main.GetClass("double"),
true, true));
m_Delegate = delegate(ktList Args)
{
if ((Args == null) || (Args.FirstNode == null) ||
(Args.FirstNode.Value == null))
{
throw new ktError("Didn't get an argument for '" +
Name + "'!", ktERR.MISSING);
}
//ktDebug.Log( "ktDF::DOUBLE(" +Args.FirstNode.Value.ToString() + ")" );
ktString S_In = new ktString(Args.FirstNode.Value.ToString());
double D_In = 0.0;
double D_Out = 0.0;
try
{
if (System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator == ",")
{
S_In.Replace(".", ",", true);
}
D_In = S_In.ToDouble();
}
catch (Exception E)
{
if (E.GetType() == typeof(System.FormatException) && !S_In.IsEmpty())
{
throw new ktError("ktDouble::CreateObject: Cant make '" + S_In + "' into an double", ktERR.WRONGTYPE);
}
}
ktDebug.Log("D_In: " + D_In.ToString());
D_Out = Delegate(D_In);
ktDebug.Log("D_Out: " + D_Out.ToString());
return new ktValue("return", "double",
kacTalk.Main.MakeObjectOf("double", D_Out),
true, true);
};
}
示例2: Escape
// "Operations"
// Escape a string /*(so it can be use as a ""plain" pattern")*/
public static ktString Escape(ktString Str)
{
Str.Replace("\\", "\\\\", true);
Str.Replace("*", "\\*", true);
Str.Replace("+", "\\+", true);
Str.Replace("?", "\\?", true);
Str.Replace("|", "\\|", true);
Str.Replace("{", "\\{", true);
Str.Replace("[", "\\[", true);
Str.Replace("(", "\\)", true);
Str.Replace(")", "\\)", true);
Str.Replace("]", "\\]", true);
Str.Replace("}", "\\}", true);
Str.Replace("^", "\\^", true);
Str.Replace("$", "\\$", true);
Str.Replace(".", "\\.", true);
Str.Replace("#", "\\#", true);
Str.Replace("/", "\\/", true);
return Str;
}
示例3: Scan
/// <summary>
/// Scan/Parse the script into tokens
/// </summary>
public bool Scan(ktString Script, ktString Name)
{
bool Ret = true;
Script.Replace("\r\n", "\n",true);
// Initiate the lineno.
m_CurLine = 1;
m_CharPos = 1;
// .. and name
m_Name = Name;
if (m_Tokens != null)
{
m_Tokens.Clear();
m_Tokens = null;
}
// Init...
ktString Line = new ktString();
int Pos = 0;
Script.Trim();
ktRegEx RE = new ktRegEx(ktToken.Separators);
// ... the block-stack
if (m_BlockStack != null)
{
m_BlockStack.Clear();
m_BlockStack = null;
}
m_BlockStack = new ktList();
// ... the token-list
if (m_Tokens != null)
{
m_Tokens.Clear();
m_Tokens = null;
}
m_Tokens = new ktList();
m_Tokens.Node = new ktNode("ktTStatement", new ktToken(ktTokenType.Statement, "", 0, 0));
// ... the token-stack
if (m_TokenStack != null)
{
m_TokenStack.Clear();
m_TokenStack = null;
}
m_TokenStack = new ktList();
// ... the lines (??)
if (m_Lines != null)
{
m_Lines.Clear();
m_Lines = null;
}
m_Lines = new ktList();
m_Lines.Node = new ktNode(Name, m_CurToken = new ktToken(ktTokenType.Program, Name, 0, 0));
// ... the line-stack
if (m_LineStack != null)
{
m_LineStack.Clear();
m_LineStack = null;
}
m_LineStack = new ktList();
if (m_MainBlock == null)
{
m_MainBlock = new ktBlock(new ktList());
}
else
{
if (m_MainBlock.Lines != null)
{
m_MainBlock.Lines.Clear();
}
m_MainBlock.ClearKTSymbols();
}
m_MainBlock.SetMain(this);
m_BlockStack.Add("ktTBlock", m_MainBlock);
/* In the "original scanner" (C++), we took one line (terminated by \n)
* at a time and worked on, now we just go through the line.
* And We hope that it will be much "leaner"!
*/
// Go on until the there's nothing left...
while (!Script.IsEmpty())
{
// Get the position for the next separator
Pos = RE.Find(Script);
// If there was none...
if (Pos < 0)
{
// Take it to the end...
Pos = Script.Len();
}
else if (Pos == 0)
{
Pos++;
//.........这里部分代码省略.........