首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# 中如何实现 Delphi 中的StrMove方法

2013-03-17 
C# 中怎么实现 Delphi 中的StrMove方法C#中如何实现Delphi中的function StrMove(Dest: PChar const Sourc

C# 中怎么实现 Delphi 中的StrMove方法
C#中如何实现Delphi中的
function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar,
StrMove方法详细是怎么替换的? C delphi
[解决办法]
试着写了一个,你参考一下

  public string StrMove(string Dest, string Source, int count)
        {
            if (count > Source.Length)
            {
                Dest = Source;
                return Dest;
            }

            if (count >= Dest.Length)
            {
                Dest = Source.Substring(0, Dest.Length);
                return Dest;
            }

            Dest = Source.Substring(0, count) + Dest.Substring(Dest.Length - count);
            return Dest;

        }

[解决办法]
说实在的,我第一次在你帖子里看到StrMove函数功能,所以百度了一下,看这个帖子里的例子才写的c#代码,你参考一下这个帖子吧
http://www.cnblogs.com/del/archive/2008/05/13/1194648.html

热点排行