本文整理汇总了C#中KacTalk.ktString.AfterFirst方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.AfterFirst方法的具体用法?C# ktString.AfterFirst怎么用?C# ktString.AfterFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktString
的用法示例。
在下文中一共展示了ktString.AfterFirst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
/// <summary>
/// This function will get the list/child corresponding the keys
/// (Keys can basically be a path [similar to a filesystem or XPath]
/// ex: "/root/child/subchild" or just an "element"/key)
/// </summary>
/// <param name="Keys">The path to the node/child</param>
/// <param name="ReturnAll">Should we return all that matches?</param>
public ktList Get(ktString Keys, bool ReturnAll)
{
// Init...
ktString Key;
ktString TmpKeys = Keys; // Temporary to save the given value
// Remove leading slashs (/)..
Keys.Trim(ktStripType.leading, "/");
if (Keys.Contains("/"))
{
// Get the first key
Key = Keys.BeforeFirst('/');
// Remove the first key
Keys = Keys.AfterFirst('/');
}
else
{
Key = Keys;
}
// If the given key matches the key of "this node" (or we didn't get a key)
if ((m_Node != null) && (m_Node.Check(Key)) || (Key == ""))
{
// Return "this"
return this;
}
// No elements??
if (m_Head == null)
{
// there's nothing to get
throw new ktError("The list is empty (in ktList::Get( " + TmpKeys + ", bool ))", ktERR.EMPTY);
}
// Init...
ktList TmpList = null;
ktList AllMatches = null;
bool GoOn = true;
Reset();
// Should we return all matches?
if (ReturnAll)
{
AllMatches = new ktList();
}
// Go thru the list..
while (MoveNext() && GoOn)
{
// Try it...
try
{
// Get the "sublist(s)"
TmpList = CurrentNode.Get(Keys, ReturnAll); // Key or Keys??
// If we should return all
if (ReturnAll)
{
// Add the found list... (and then go on)
AllMatches.Add(TmpList);
}
else
{
// Stop looking...
GoOn = false;
}
// Catch an error...
}
catch (ktError E)
{
// If it was an error other than "Not found" or empty...
if ((E.ErrorNumber != ktERR._404) && (E.ErrorNumber != ktERR.EMPTY))
{
// Re-throw it
throw E;
} // If
} // Catch
} // While
// If we should return all matches and
// we found something (The list isn't empty)
if (ReturnAll && (!AllMatches.IsEmpty()))
{
// Set GoOn to false (as it marks a found node/list)
GoOn = false;
}
// If we should get all matches but only found one
if (ReturnAll && (AllMatches.GetCount() == 1))
{
// Get the first (and only) child
TmpList = AllMatches.First;
//.........这里部分代码省略.........