📄 strs.h
字号:
/***********************************************************
** @(#) Strs.c
** Purpose : String Tools
** Version : 1.2.0
** Date : 1999/08/05
** Developer : Rick Zhang (Zhang MingDe)
***********************************************************/
/***************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/***************************************************/
#ifndef _STRS_H_
#define _STRS_H_
#ifdef __cplusplus
extern "C" {
#endif
/**********************************************************************************
* Function:
* 1. Remove all spaces (' ') and Tab ('\t') in the end and in the
* beginning of 'Str'
* Arguments:
* IN :
* Str
* OUT :
* Str
* Return:
* No
***********************************************************************************/
void Trim(char * Str);
/**********************************************************************************
* Function:
* 1. If there exists more than 2 spaces between words in 'Str', remove all
* but only leave one, notes thar regard Tab ('\t') as space.
* 2. Remove all spaces (' ') and Tab ('\t') in the end and in the
* beginning of 'Str'
* Arguments:
* IN :
* Str
* OUT :
* Str
* Return:
* No
***********************************************************************************/
void RemoveRedundantSpace(char * Str);
/**********************************************************************************
* Function:
* 1. Change all alphabet to upper case in 'Str'
* Arguments:
* IN :
* Str
* OUT :
* Str
* Return:
* No
***********************************************************************************/
void ToUpper(char * Str);
/**********************************************************************************
* Function:
* 1. Change all alphabet to lower case in 'Str'
* Arguments:
* IN :
* Str
* OUT :
* Str
* Return:
* No
***********************************************************************************/
void ToLower(char * Str);
/**********************************************************************************
* Function:
* 1. Replace the first 'oldstr' with 'newstr' in 'srcstr'
* Arguments:
* IN :
* srcstr
* oldstr
* newstr
* OUT :
* srcstr
* Return:
* 1. If find and replace one 'oldstr' with 'newstr' in 'srcstr', return 1
* 2. If find no 'oldstr' in 'srcstr', return 0
* 3. If error (malloc return NULL) return -1
* Notes:
* 1. srcstr should be large size enough.
***********************************************************************************/
int StrReplace(char * srcstr, char * oldstr, char * newstr);
#ifdef __cplusplus
}
#endif
#endif
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -