本文整理汇总了C#中System.String.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# String.Clone方法的具体用法?C# String.Clone怎么用?C# String.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NetworkShare
/// <summary>
/// Constructor with UNC
/// </summary>
/// <param name="path">The share name - UNC</param>
public NetworkShare( String path )
{
String hostName = "";
// check if the UNC is valid
unc = (String) path.Clone();
if( path.StartsWith( @"\\" ) )
{
path = path.Remove( 0, 2 );
int i = path.IndexOf( @"\" );
if( i < 0 )
{
goto _abort;
}
hostName = path.Substring( 0, path.IndexOf( @"\" ) );
path = path.Remove( 0, i );
if( path == null || path.Length < 1 )
{
goto _abort;
}
// remove the first "\"
remotePath = (String) path.Remove( 0, 1 );
if( remotePath == null || remotePath.Length < 1 )
{
goto _abort;
}
goto _ok;
}
_abort:
throw new Exception( "Invalid UNC path: " + unc );
_ok:
{
host = new NetworkHost( hostName, 0 /* dummy */ );
}
}
示例2: parseSCTags
public static String parseSCTags(String text)
{
int sc_start_index = -1;
int sc_end_index = -1;
String text_to_upper = "";
String message = (String)text.Clone();
sc_start_index = message.IndexOf(SC_START_TAG);
int start_text_index = -1;
while (sc_start_index != -1)
{
sc_end_index = message.IndexOf(SC_END_TAG);
if (sc_end_index == -1)
{
Console.WriteLine("NO CLOSING SC TAG FOUND IN A VERSE: " + message);
return message;
}
start_text_index = sc_start_index + SC_START_TAG.Length;
text_to_upper = message.Substring(start_text_index, sc_end_index - start_text_index);
message = message.Remove(sc_start_index, (sc_end_index - sc_start_index) + SC_END_TAG.Length);
message = message.Insert(sc_start_index, text_to_upper.ToUpper());
sc_start_index = message.IndexOf(SC_START_TAG);
}
return message;
}
示例3: CommandGroup
private String m_InternalName; // The access key of this group
#endregion Fields
#region Constructors
public CommandGroup(String InternalName, String DisplayName
, CommandManger CommandManager)
{
m_InternalName = InternalName.Clone() as String;
m_DisplayName = DisplayName.Clone() as String;
m_Commands = new FRList<String>();
m_CommandManager = CommandManager;
}
示例4: IrcLine
public IrcLine(IrcClient client, String prefix, String command, String[] parameters)
{
this.client = client;
this.prefix = prefix;
this.command = command;
parameters = (String[])parameters.Clone();
Int32.TryParse(command, out numeric);
}
示例5: BoundedBroydenFletcherGoldfarbShannoInnerStatus
/// <summary>
/// Initializes a new instance of the <see cref="BoundedBroydenFletcherGoldfarbShannoInnerStatus"/> class with the inner
/// status values from the original FORTRAN L-BFGS implementation.
/// </summary>
///
/// <param name="isave">The isave L-BFGS status argument.</param>
/// <param name="dsave">The dsave L-BFGS status argument.</param>
/// <param name="lsave">The lsave L-BFGS status argument.</param>
/// <param name="csave">The csave L-BFGS status argument.</param>
/// <param name="work">The work L-BFGS status argument.</param>
///
public BoundedBroydenFletcherGoldfarbShannoInnerStatus(
int[] isave, double[] dsave, bool[] lsave, String csave, double[] work)
{
this.Integers = (int[])isave.Clone();
this.Doubles = (double[])dsave.Clone();
this.Booleans = (bool[])lsave.Clone();
this.Strings = (string)csave.Clone();
this.Work = (double[])work.Clone();
}
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:20,代码来源:BoundedBroydenFletcherGoldfarbShannoInnerStatus.cs
示例6: GenerateConfigurationList
public RawLogItemConfiguratorWindow GenerateConfigurationList(String[] sampleLogLine)
{
SampleLogLine = (String[])sampleLogLine.Clone();
for(int logItemIndex = 0; logItemIndex < sampleLogLine.Length; logItemIndex += 1)
{
CreateLogItemCandidate(logItemIndex, sampleLogLine[logItemIndex]);
}
this.ShowDialog();
return this;
}
示例7: GetLinkToDescription
/// <summary>
/// Retourne le lien d'un article contenu dans sa description
/// </summary>
/// <param name="description">description contenant le lien</param>
/// <returns>lien de l'article</returns>
protected String GetLinkToDescription(String description)
{
// DECLARATION
String linkTmp, resultLink;
StringBuilder linkBuf;
int indexStart, indexEnd;
Char[] linkToCharArray;
// INITIALISATION
resultLink = null;
linkBuf = new StringBuilder();
// on clone la description
linkTmp = (String) description.Clone();
// on remplace les caracteres "<" par le charactere "<"
// "<" charactere hexa de "<"
linkTmp = description.Replace(">", "<");
// on remplace les caracteres ">" par le charactere ">"
// ">" charactere hexa de ">"
linkTmp = description.Replace(">", ">");
// on remplace les caracteres """ par le charactere """
// """ charactere hexa de """
//linkTmp = description.Replace(""", "\"");
// on recupere le texte contenu dans les balises <a> </a>
indexStart = description.IndexOf("<a");
indexEnd = description.IndexOf("</a>");
if ((indexStart != -1) && (indexEnd != -1))
{
linkTmp = linkTmp.Substring(indexStart, indexEnd - indexStart);
// on verifie que les balises <a> contiennent le mot cle "href"
if (linkTmp.Contains("href"))
{
linkToCharArray = linkTmp.ToCharArray();
for (int i = (linkTmp.IndexOf('"') + 1); linkToCharArray[i] != '"'; i++)
{
linkBuf.Append(linkToCharArray[i]);
}
}
resultLink = linkBuf.ToString();
}
return resultLink;
}
示例8: CustomPropertyGroup
public CustomPropertyGroup(String n,String p)
{
name = filepath = null;
if (n != null)
{
name = (String)n.Clone();
}
;
if (p != null)
{
filepath = (String)p.Clone() ;
}
customproperties = new SerializableDictionary();
}
示例9: canonize
/**
* returns the canonized form of the given link
*/
public String canonize(String link)
{
String modifiedLink = (String)link.Clone();
String[] prefixOfLink = modifiedLink.Split(":// ".Split(' '),StringSplitOptions.RemoveEmptyEntries);
if (prefixOfLink.Length != 2)
{
modifiedLink = prefix + "://" + modifiedLink;
}
if (modifiedLink[modifiedLink.Length - 1] == '/')
modifiedLink = modifiedLink.Remove(modifiedLink.Length - 1);
return modifiedLink;
}
示例10: Substitute
public void Substitute(String reqId, TextWriter output)
{
// Read in the template file
StringBuilder sb = new StringBuilder("");
try
{
Assembly _assembly = Assembly.GetExecutingAssembly();
StreamReader sr = new StreamReader(_assembly.GetManifestResourceStream("RefactoringExample.template.html"));
String line;
while (((line = sr.ReadLine()) != "") && (line != null))
sb = new StringBuilder(sb + line + "\n");
sr.Close();
}
catch (Exception e)
{
}
SourceTemplate = sb.ToString();
try
{
String template = (string)SourceTemplate.Clone();
// Substitute for %CODE%
int templateSplitBegin = template.IndexOf("%CODE%");
int templateSplitEnd = templateSplitBegin + 6;
String templatePartOne = template.Substring(0, templateSplitBegin);
String templatePartTwo = template.Substring(templateSplitEnd, template.Length - 1);
_code = reqId.ToString();
template = templatePartOne + _code + templatePartTwo;
// Substitute for %ALTCODE%
templateSplitBegin = template.IndexOf("%ALTCODE%");
templateSplitEnd = templateSplitBegin + 9;
templatePartOne = template.Substring(0, templateSplitBegin);
templatePartTwo = template.Substring(templateSplitEnd, template.Length - 1);
_altcode = _code.Substring(0, 4) + "-" + _code.Substring(4, 4);
output.Write(templatePartOne + _altcode + templatePartTwo);
}
catch (Exception e)
{
Console.WriteLine("Error in substitute()");
}
output.Flush();
output.Close();
}
示例11: LLETextBox
public LLETextBox(Vector2 position, Texture2D bgTexture, Texture2D cursorImg, String text, SpriteFont font,
int maxLength, OnClickEvent clickEvent)
: base(position, bgTexture, font, "", clickEvent)
{
mCursorImg = cursorImg;
mText = (string)text.Clone();
mMaxLength = maxLength;
setFontColors(Color.Black, Color.Black, Color.Gray);
setColors(Color.DarkGray, Color.LightGray, Color.Gray);
mIndex = -1;
mHasFocus = false;
mCursorColor = Color.Black;
adjustCursor();
}
示例12: setUserName
public void setUserName(String uname)
{
userName = (String)uname.Clone();
}
示例13: setPassword
public void setPassword(String pwd)
{
password = (String)pwd.Clone();
}
示例14: setIpAddress
public void setIpAddress(String ip)
{
ipAddress = (String)ip.Clone();
}
示例15: setDatabase
public void setDatabase(String db)
{
database = (String)db.Clone();
}