zoukankan      html  css  js  c++  java
  • 截取字符串(C版)

    下面代码中全是c的东西

    本人写了一个字符串子串获取方法

     1 char *SubString(char *dest ,const char *source ,int iBegin ,int iLen)
     2 {
     3     char *result = dest;
     4     
     5     if (source == NULL)
     6         return result;
     7     
     8     if (iBegin < 0 || iLen < 1)
     9         return result;
    10         
    11     while(iBegin-- != 0)
    12         source++;
    13     
    14     while(iLen-- != 0 && *source != '\0')
    15     {
    16         *dest = *source;
    17         dest++;
    18         source++;
    19     }
    20     
    21     *dest = '\0';
    22     
    23     return result;
    24 }


    好,贴出完整代码,用tc3.0编译通过

    ShowCode



  • 相关阅读:
    POJ 1330 Nearest Common Ancestors (LCA,dfs+ST在线算法)
    BZOJ 2002: [Hnoi2010]Bounce 弹飞绵羊 (动态树LCT)
    HDU 4010 Query on The Trees (动态树)
    SPOJ 375. Query on a tree (动态树)
    BZOJ 2049: [Sdoi2008]Cave 洞穴勘测 (动态树入门)
    HDU 3726 Graph and Queries (离线处理+splay tree)
    POJ 3580 SuperMemo (splay tree)
    Android中visibility属性VISIBLE、INVISIBLE、GONE的区别
    mysql如何在一张表中插入一万条数据?(用存储过程解决)
    Gradle Build速度加快方法汇总
  • 原文地址:https://www.cnblogs.com/GoGoagg/p/1283222.html
Copyright © 2011-2022 走看看