当前位置: 首页>>代码示例>>C#>>正文


C# String.Clone方法代码示例

本文整理汇总了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 */ );
     }
 }
开发者ID:BackupTheBerlios,项目名称:shareindex,代码行数:38,代码来源:NetworkShare.cs

示例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;
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:25,代码来源:NetBible.cs

示例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;
        }
开发者ID:JeffreyZksun,项目名称:opendraw,代码行数:14,代码来源:CommandGroup.cs

示例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);
 }
开发者ID:hapm,项目名称:IrcShark,代码行数:8,代码来源:IrcLine.cs

示例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;
		}
开发者ID:yeegahng,项目名称:CLV,代码行数:12,代码来源:RawLogItemConfiguratorWindow.cs

示例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 "&lt;" par le charactere "<"
            //   "&lt;" charactere hexa de "<"
            linkTmp = description.Replace("&gt;", "<");

            // on remplace les caracteres "&gt;" par le charactere ">"
            //   "&gt;" charactere hexa de ">"
            linkTmp = description.Replace("&gt;", ">");

            // on remplace les caracteres "&quot;" par le charactere """
            //   "&quot;" charactere hexa de """
            //linkTmp = description.Replace("&quot;", "\"");

            // 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;
        }
开发者ID:juliensadaoui,项目名称:news-viewer,代码行数:56,代码来源:RSS_2_0_Parser.cs

示例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();
 }
开发者ID:hzl2928963,项目名称:gleed2d_for_VCS2010,代码行数:14,代码来源:Editor.cs

示例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;
        }
开发者ID:eumagnun,项目名称:iwebcrawler,代码行数:18,代码来源:Filter.cs

示例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();
        }
开发者ID:pjvds,项目名称:tdd-workshop,代码行数:46,代码来源:CodeReplacer.cs

示例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();
        }
开发者ID:caiodantas,项目名称:LemonLiteEngine,代码行数:22,代码来源:LLETextBox.cs

示例12: setUserName

 public void setUserName(String uname)
 {
     userName = (String)uname.Clone();
 }
开发者ID:dair,项目名称:Albion-LARP-Software,代码行数:4,代码来源:Connection.cs

示例13: setPassword

 public void setPassword(String pwd)
 {
     password = (String)pwd.Clone();
 }
开发者ID:dair,项目名称:Albion-LARP-Software,代码行数:4,代码来源:Connection.cs

示例14: setIpAddress

 public void setIpAddress(String ip)
 {
     ipAddress = (String)ip.Clone();
 }
开发者ID:dair,项目名称:Albion-LARP-Software,代码行数:4,代码来源:Connection.cs

示例15: setDatabase

 public void setDatabase(String db)
 {
     database = (String)db.Clone();
 }
开发者ID:dair,项目名称:Albion-LARP-Software,代码行数:4,代码来源:Connection.cs


注:本文中的System.String.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。