C#中如何实现Delphi中的
function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar,
StrMove方法详细是怎么替换的?Cdelphi

解决方案 »

  1.   

    试着写了一个,你参考一下
      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;        }
      

  2.   

    能给我具体解释下Delphi中的StrMove方法吗,谢谢
      

  3.   

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

  4.   

    找到方法了,调用msvcrt.dll就能实现[DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
            public static extern string MemCopy(string dest, string src, int count);