您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ string_find函数代码示例

51自学网 2021-06-03 08:30:15
  C++
这篇教程C++ string_find函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中string_find函数的典型用法代码示例。如果您正苦于以下问题:C++ string_find函数的具体用法?C++ string_find怎么用?C++ string_find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了string_find函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _config_string_to_real

static real _config_string_to_real( const char* str ){	unsigned int length = string_length( str );	unsigned int first_nonnumeric;	unsigned int dot_position;	if( length < 2 )		return string_to_real( str );	first_nonnumeric = string_find_first_not_of( str, "0123456789.", 0 );	if( ( first_nonnumeric == ( length - 1 ) ) && ( ( str[ first_nonnumeric ] == 'm' ) || ( str[ first_nonnumeric ] == 'M' ) ) )	{		dot_position = string_find( str, '.', 0 );		if( dot_position != STRING_NPOS )		{			if( string_find( str, '.', dot_position + 1 ) != STRING_NPOS )				return string_to_real( str ); //More than one dot		}		return string_to_real( str ) * ( REAL_C( 1024.0 ) * REAL_C( 1024.0 ) );	}	if( ( first_nonnumeric == ( length - 1 ) ) && ( ( str[ first_nonnumeric ] == 'k' ) || ( str[ first_nonnumeric ] == 'K' ) ) )	{		dot_position = string_find( str, '.', 0 );		if( dot_position != STRING_NPOS )		{			if( string_find( str, '.', dot_position + 1 ) != STRING_NPOS )				return string_to_real( str ); //More than one dot		}		return string_to_real( str ) * REAL_C( 1024.0 );	}	return string_to_real( str );}
开发者ID:apprisi,项目名称:foundation_lib,代码行数:32,


示例2: config_parse_commandline

void config_parse_commandline( const char* const* cmdline, unsigned int num ){	//TODO: Implement, format --section:key=value	unsigned int arg;	for( arg = 0; arg < num; ++arg )	{		if( string_match_pattern( cmdline[arg], "--*:*=*" ) )		{			unsigned int first_sep = string_find( cmdline[arg], ':', 0 );			unsigned int second_sep = string_find( cmdline[arg], '=', 0 );			if( ( first_sep != STRING_NPOS ) && ( second_sep != STRING_NPOS ) && ( first_sep < second_sep ) )			{				unsigned int section_length = first_sep - 2;				unsigned int end_pos = first_sep + 1;				unsigned int key_length = second_sep - end_pos;				const char* section_str = cmdline[arg] + 2;				const char* key_str = pointer_offset_const( cmdline[arg], end_pos );								hash_t section = hash( section_str, section_length );				hash_t key = hash( key_str, key_length );								char* value = string_substr( cmdline[arg], second_sep + 1, STRING_NPOS );				char* set_value = value;								unsigned int value_length = string_length( value );								if( !value_length )					config_set_string( section, key, "" );				else if( string_equal( value, "false" ) )					config_set_bool( section, key, false );				else if( string_equal( value, "true" ) )					config_set_bool( section, key, true );				else if( ( string_find( value, '.', 0 ) != STRING_NPOS ) && ( string_find_first_not_of( value, "0123456789.", 0 ) == STRING_NPOS ) && ( string_find( value, '.', string_find( value, '.', 0 ) + 1 ) == STRING_NPOS ) ) //Exactly one "."					config_set_real( section, key, string_to_real( value ) );				else if( string_find_first_not_of( value, "0123456789", 0 ) == STRING_NPOS )					config_set_int( section, key, string_to_int64( value ) );				else				{					if( ( value_length > 1 ) && ( value[0] == '"' ) && ( value[ value_length - 1 ] == '"' ) )					{						value[ value_length - 1 ] = 0;						set_value = value + 1;						config_set_string( section, key, set_value );					}					else					{						config_set_string( section, key, value );					}				}				log_infof( HASH_CONFIG, "Config value from command line: %.*s:%.*s = %s", section_length, section_str, key_length, key_str, set_value );								string_deallocate( value );			}			}	}}
开发者ID:apprisi,项目名称:foundation_lib,代码行数:58,


示例3: get_configBlock

void configureObject::parse_bc_info(vector<string> &orgin_text){try{    vector<string> config_block;    get_configBlock("bcConfig", orgin_text, config_block);    const int item_num = 5;    for(auto it = config_block.begin(); it != config_block.end(); it++)    {        string &str = *it;        bcConfig *bc = parse_bc_config(str, item_num);        if(bc)        {            m_bc_info.add_bcConfig(bc);        }    }    for(auto it = orgin_text.begin(); it != orgin_text.end();it++)    {        string &str = *it;        if(string_find(str, "redisConfig"))        {            string redisLine;            if(get_subString(str, '=', ';', redisLine) == false) throw 0;            vector<string> subStringList;            if(parseBraces(redisLine, subStringList)==true)            {                if(subStringList.size()!=3) throw 0;                if((is_number(subStringList.at(1))==false)||(is_number(subStringList.at(2))==false)) throw 0;                int port = atoi(subStringList.at(1).c_str());                int timeout = atoi(subStringList.at(2).c_str());                if((port>short_max)||(timeout>short_max))throw 0;                m_bc_info.set_redis(subStringList.at(0), (unsigned short)port, (unsigned short)timeout);                break;            }        }    }         string value;    for(auto it = orgin_text.begin(); it != orgin_text.end();it++)    {        string &str = *it;        if(string_find(str, "logLevel"))        {            string redisLine;            if(get_subString(str, '=', ';', value) == false) throw 0;              int level = atoi(value.c_str());            m_bc_info.set_logLevel(level);        }    }      }catch(...){    g_manager_logger->emerg("bc redis config error");    exit(1);}}
开发者ID:penghuijun,项目名称:backupSys,代码行数:56,


示例4: glsl_dim_from_token

static intglsl_dim_from_token(const string_const_t token) {	string_const_t dim;	size_t ofs = string_find(STRING_ARGS(token), '[', 0);	if (ofs == STRING_NPOS)		return 1;	++ofs;	dim = string_substr(STRING_ARGS(token), ofs, string_find(STRING_ARGS(token), ']', ofs) - ofs);	return string_to_int(STRING_ARGS(dim));}
开发者ID:rampantpixels,项目名称:render_lib,代码行数:10,


示例5: _expand_string

static NOINLINE char* _expand_string( hash_t section_current, char* str ){	char* expanded;	char* variable;	unsigned int var_pos, var_end_pos, variable_length, separator, var_offset;	hash_t section, key;	expanded = str;	var_pos = string_find_string( expanded, "$(", 0 );	while( var_pos != STRING_NPOS )	{		var_end_pos = string_find( expanded, ')', var_pos + 2 );		FOUNDATION_ASSERT_MSG( var_end_pos != STRING_NPOS, "Malformed config variable statement" );		variable = string_substr( expanded, var_pos, ( var_end_pos != STRING_NPOS ) ? ( 1 + var_end_pos - var_pos ) : STRING_NPOS );		section = section_current;		key = 0;		variable_length = string_length( variable );		separator = string_find( variable, ':', 0 );		if( separator != STRING_NPOS )		{			if( separator != 2 )				section = hash( variable + 2, separator - 2 );			var_offset = separator + 1;		}		else		{			var_offset = 2;		}		key = hash( variable + var_offset, variable_length - ( var_offset + ( variable[ variable_length - 1 ] == ')' ? 1 : 0 ) ) );		if( expanded == str )			expanded = string_clone( str );		if( section != HASH_ENVIRONMENT )			expanded = string_replace( expanded, variable, config_string( section, key ), false );		else			expanded = string_replace( expanded, variable, _expand_environment( key, variable + var_offset ), false );		string_deallocate( variable );		var_pos = string_find_string( expanded, "$(", 0 );	}#if BUILD_ENABLE_DEBUG_CONFIG	if( str != expanded )		log_debugf( HASH_CONFIG, "Expanded config value /"%s/" to /"%s/"", str, expanded );#endif	return expanded;}
开发者ID:apprisi,项目名称:foundation_lib,代码行数:50,


示例6: string_replace_all

int string_replace_all(string *s, char *find, char *sub){  size_t i;  int e;  for (i = string_find(s, find, 0); i != (size_t) -1; i = string_find(s, find, i + strlen(sub)))    {      e = string_replace(s, i, strlen(find), sub);      if (e == -1)        return -1;    }  return 0;}
开发者ID:ifzz,项目名称:libdynamic,代码行数:14,


示例7: _expand_environment

static NOINLINE const char* _expand_environment( hash_t key, char* var ){	if( key == HASH_EXECUTABLE_NAME )		return environment_executable_name();	else if( key == HASH_EXECUTABLE_DIRECTORY )		return environment_executable_directory();	else if( key == HASH_EXECUTABLE_PATH )		return environment_executable_path();	else if( key == HASH_INITIAL_WORKING_DIRECTORY )		return environment_initial_working_directory();	else if( key == HASH_CURRENT_WORKING_DIRECTORY )		return environment_current_working_directory();	else if( key == HASH_HOME_DIRECTORY )		return environment_home_directory();	else if( key == HASH_TEMPORARY_DIRECTORY )		return environment_temporary_directory();	else if( string_equal_substr( var, "variable[", 9 ) )  //variable[varname] - Environment variable named "varname"	{		const char* value;		unsigned int end_pos = string_find( var, ']', 9 );		if( end_pos != STRING_NPOS )			var[end_pos] = 0;		value = environment_variable( var );		if( end_pos != STRING_NPOS )			var[end_pos] = ']';		return value;	}	return "";}
开发者ID:apprisi,项目名称:foundation_lib,代码行数:29,


示例8: perl_substitute__

/*----------------------------------------------------------------------------perl_substitute__()The pattern substitution function which includes loading perl interpreter and doing the pattern substitution, then returning the replaced string.arguments:   input: char* string, input text	 char* pattern, match pattern  output:char* string, output text----------------------------------------------------------------------------*/int perl_substitute__( void ){  SV *text;    /* Perl representation for the string to be 		  modified by substitution */   char *subst_cmd = ptoc_string(CTXTc 2);  #ifdef MULTI_THREAD  if( NULL == th)	th = xsb_get_main_thread();#endif  /* first load the perl interpreter, if unloaded */  if (perlObjectStatus == UNLOADED) load_perl__();    text = newSV(0);  sv_setpv(text, ptoc_string(CTXTc 1));  /* put the string to the SV */       if( !substitute(&text, subst_cmd) )    return(FAILURE);    global_pattern_mode = is_global_pattern(subst_cmd);  if (substituteString != NULL ) free(substituteString);  substituteString = malloc(strlen(SvPV(text,PL_na))+1);  strcpy(substituteString,SvPV(text,PL_na));    SvREFCNT_dec(text);  /*release space*/    ctop_string(CTXTc 3, string_find(substituteString,1));  /*return changed text*/  return SUCCESS;}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:41,


示例9: get_bulk_match_result__

int get_bulk_match_result__( void ) {#ifdef MULTI_THREAD  if( NULL == th)	th = xsb_get_main_thread();#endif  if (perlObjectStatus == UNLOADED ) {    load_perl__();    return(FAILURE);  }  if ( bulkMatchList[ptoc_int(CTXTc 1)] == NULL )    return FAILURE;        /*no match*/  else{    int match_seq_number= ptoc_int(CTXTc 1);    int match_array_sz= ptoc_int(CTXTc 3);    if (match_seq_number < match_array_sz) {      /* c2p_string(CTXTc  bulkMatchList[match_seq_number], reg_term(CTXTc 2)); */      ctop_string(CTXTc 2, (char *)string_find(bulkMatchList[match_seq_number],1));      return SUCCESS;    }    else return FAILURE;  }}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:25,


示例10: string_find

int String::find(char ch, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  if (empty()) return -1;  // Ignore taint in comparison functions.  return string_find(m_px->dataIgnoreTaint(), m_px->size(), ch, pos,                     caseSensitive);}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:7,


示例11: _mixer_get_icon

/* mixer_get_icon */static String const * _mixer_get_icon(String const * id){	struct	{		String const * name;		String const * icon;	} icons[] = {		{ "beep",	"audio-volume-high"		},		{ "cd",		"media-cdrom"			},		{ "dac",	"audio-card"			},		{ "input",	"stock_mic"			},		{ "line",	"stock_volume"			},		{ "master",	"audio-volume-high"		},		{ "mic",	"audio-input-microphone"	},		{ "monitor",	"utilities-system-monitor"	},		{ "output",	"audio-volume-high"		},		{ "pcm",	"audio-volume-high"		},		{ "rec",	"gtk-media-record"		},		{ "source",	"audio-card"			},		{ "vol",	"audio-volume-high"		}	};	size_t len;	size_t i;	for(i = 0; i < sizeof(icons) / sizeof(*icons); i++)		if(strncmp(icons[i].name, id, string_length(icons[i].name))				== 0)			return icons[i].icon;	len = string_length(id);	if(string_find(id, "sel") != NULL)		return "multimedia";	else if(len > 5 && string_compare(&id[len - 5], ".mute") == 0)		return "audio-volume-muted";	return "audio-volume-high";}
开发者ID:DeforaOS,项目名称:Mixer,代码行数:36,


示例12: find

int String::find(const String& s, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  if (empty()) return -1;  if (s.size() == 1) {    return find(*s.data(), pos, caseSensitive);  }  return string_find(m_str->data(), m_str->size(),                     s.data(), s.size(), pos, caseSensitive);}
开发者ID:shantanusharma,项目名称:hhvm,代码行数:9,


示例13: assert

int String::find(const char *s, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  assert(s);  if (empty()) return -1;  if (*s && *(s+1) == 0) {    return find(*s, pos, caseSensitive);  }  return string_find(m_px->data(), m_px->size(), s, strlen(s),                     pos, caseSensitive);}
开发者ID:silvajohnny,项目名称:hiphop-php,代码行数:10,


示例14: input_turn

void input_turn(gameType * game) {    /*        Read and split player input into arguments for the parser    */    int pos;    int bufUsed = 0, bufSize = BUFFER_INCREMENT;    char * buf, * arg1, * arg2, * temp, c;        printf("Player (%c)> ", game->whoseTurn);        /* Read stdin to buffer */    buf = (char *) malloc(sizeof(char) * bufSize);    while ( (c = getchar()) != '/n' && !feof(stdin) ) {        bufUsed++;        /* Expand memory if needed */        if (bufSize <= bufUsed) {            bufSize += BUFFER_INCREMENT;            temp = (char *) malloc(sizeof(char) * bufSize);            memcpy(temp, buf, sizeof(char) * bufSize-BUFFER_INCREMENT);            buf = temp;			free(temp);        }        buf[bufUsed-1] = c;    }    buf[bufUsed] = '/0';    /* Catch EoF-only input */    if ((bufUsed == 0) && (c != '/n')) {        sysMessage(10, game);    }    	if (buf[0]=='s') {				/* Save file */		parse_turn(1, buf, "", game);			} else {				/* Play a turn */		pos = string_find(buf, ' ');		if (pos > 0) {			/* Two arguments */			arg1 = (char *) malloc( sizeof(char) * (pos+1) );			arg2 = (char *) malloc( sizeof(char) * (bufUsed-pos) );			memcpy( arg1, &buf[0], sizeof(char) * pos);			memcpy( arg2, &buf[pos+1], sizeof(char) * (bufUsed-pos-1));			arg1[pos] = '/0';			arg2[strlen(buf)-pos-1] = '/0';			/* Send to parser and free memory */			parse_turn(2, arg1, arg2, game);			free(arg1);			free(arg2);		}	}	free(buf);}
开发者ID:CPonty,项目名称:Flip,代码行数:55,


示例15: find

HOT_FUNCint String::find(CStrRef s, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  if (empty()) return -1;  if (s.size() == 1) {    return find(*s.dataIgnoreTaint(), pos, caseSensitive);  }  // Ignore taint in comparison functions.  return string_find(m_px->dataIgnoreTaint(), m_px->size(),                     s.dataIgnoreTaint(), s.size(), pos, caseSensitive);}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:11,


示例16: ASSERT

int String::find(const char *s, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  ASSERT(s);  if (empty()) return -1;  if (*s && *(s+1) == 0) {    return find(*s, pos, caseSensitive);  }  // Ignore taint in comparison functions.  return string_find(m_px->dataIgnoreTaint(), m_px->size(), s, strlen(s),                     pos, caseSensitive);}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:11,


示例17: make_psc_rec

/* *  Create a PSC record and initialize its fields. */static Psc make_psc_rec(char *name, char arity) {    Psc temp;    temp = (Psc)mem_alloc(sizeof(struct psc_rec),ATOM_SPACE);    //  set_env(temp, 0);    //  set_spy(temp, 0);    //  set_shared(temp, 0);    //  set_tabled(temp, 0);    set_name(temp, string_find(name, 1));    set_arity(temp, arity);    init_psc_ep_info(temp);    return temp;}
开发者ID:jianqiao,项目名称:code,代码行数:16,


示例18: path_base_file_name

char* path_base_file_name( const char* path ){	unsigned int start, end;	if( !path )		return string_allocate( 0 );	start = string_find_last_of( path, "///", STRING_NPOS );	end = string_find( path, '.', ( start != STRING_NPOS ) ? start : 0 );	//For "dot" files, i.e files with names like "/path/to/.file", return the dot name ".file"	if( !end || ( end == ( start + 1 ) ) )		end = STRING_NPOS;	if( start != STRING_NPOS )		return string_substr( path, start + 1, ( end != STRING_NPOS ) ? ( end - start - 1 ) : STRING_NPOS );	return string_substr( path, 0, end );}
开发者ID:HardlyHaki,项目名称:ProDBG,代码行数:14,


示例19: make_psc_rec

/* *  Create a PSC record and initialize its fields. */static Psc make_psc_rec(char *name, char arity) {  Psc temp;  int length;    length = strlen(name);  temp = (Psc)mem_alloc(sizeof(struct psc_rec));  set_env(temp, 0);  set_type(temp, 0);  set_spy(temp, 0);  set_arity(temp, arity);  set_length(temp, length);  set_data(temp, 0);  set_ep(temp,(byte *)&(temp->load_inst));  set_name(temp, string_find(name, 1));  cell_opcode(&(temp->load_inst)) = load_pred;  temp->this_psc = temp;  return temp;}
开发者ID:eden,项目名称:navajoverb,代码行数:21,


示例20: make_psc_rec

/* *  Create a PSC record and initialize its fields. */static Psc make_psc_rec(char *name, char arity) {  Psc temp;    temp = (Psc)mem_alloc(sizeof(struct psc_rec),ATOM_SPACE);  set_type(temp, 0);  temp->env = 0;  //  set_env(temp, 0);  //  set_spy(temp, 0);  //  set_shared(temp, 0);  //  set_tabled(temp, 0);  temp->incr = 0;  set_arity(temp, arity);  set_data(temp, 0);  set_ep(temp,(byte *)&(temp->load_inst));  set_name(temp, string_find(name, 1));  cell_opcode(&(temp->load_inst)) = load_pred;  temp->this_psc = temp;  return temp;}
开发者ID:flavioc,项目名称:XSB,代码行数:22,


示例21: str_cat

xsbBool str_cat(CTXTdecl){    char *str1, *str2, *tmpstr;    size_t tmpstr_len;    term = ptoc_tag(CTXTc 1);    term2 = ptoc_tag(CTXTc 2);    if (isatom(term) && isatom(term2)) {        str1 = string_val(term);        str2 = string_val(term2);        tmpstr_len = strlen(str1) + strlen(str2) + 1;        tmpstr = (char *)mem_alloc(tmpstr_len,LEAK_SPACE);        strcpy(tmpstr, str1);        strcat(tmpstr, str2);        str1 = string_find(tmpstr, 1);        mem_dealloc(tmpstr,tmpstr_len,LEAK_SPACE);        return atom_unify(CTXTc makestring(str1), ptoc_tag(CTXTc 3));    } else return FALSE;}
开发者ID:jianqiao,项目名称:code,代码行数:20,


示例22: get_bulk_match_result__

int get_bulk_match_result__( void ) {  if (perlObjectStatus == UNLOADED ) {    load_perl__();    return(FAILURE);  }  if ( bulkMatchList[ptoc_int(1)] == NULL )    return FAILURE;        /*no match*/  else{    int match_seq_number= ptoc_int(1);    int match_array_sz= ptoc_int(3);    if (match_seq_number < match_array_sz) {      /* c2p_string( bulkMatchList[match_seq_number], reg_term(2)); */      ctop_string(2, (char *)string_find(bulkMatchList[match_seq_number],1));      return SUCCESS;    }    else return FAILURE;  }}
开发者ID:eden,项目名称:navajoverb,代码行数:20,


示例23: block_over

void configureObject::get_configBlock(const char* blockSym, vector<string>& orgin_text,  vector<string>& result_text){                   int left_braces = 0;     bool config_start = false;    for(auto it = orgin_text.begin(); it != orgin_text.end(); it++)    {        string &str = *it;        if(str.empty() || str.at(0)== '#') continue;// Comments or blank lines        if(config_start)        {            if(left_braces == 0)            {                if(str.find('{') != string::npos)                {                    left_braces++;                }                continue;            }            else             {                              int res_left_braces = 0;                block_over(str, left_braces, res_left_braces);                left_braces = res_left_braces;                result_text.push_back(str);                if(left_braces==0)                {                    return;                }            }        }        else if(string_find(str, blockSym))        {            config_start = true;                if(str.find('{') != string::npos)            {                left_braces++;            }        }    }}
开发者ID:penghuijun,项目名称:backupSys,代码行数:41,


示例24: def

int def(tokens_t *tp, tokens_t **ep){    tokens_t *t;    preproc_t *p;    strs_t *st;    if (tp->ttype == TT_OPR && tp->num == OPR_SIZEOF) {        tp++;        syntax(tp->ttype == TT_SYM, "expected sizeof sym");        if ((p = pre(tp->str, PT_STRUCT))) {            if (debug) printf("sizeof %s <- %d/n", tp->str, p->size);            pullup(tp, tp+1, ep);            tp--;            tp->ttype = TT_NUM;            tp->num = p->size;            tp++;            return 1;        }        if (debug) printf("unknown sizeof: %s (likely fwd ref)/n", tp->str);    }    if (tp->ttype == TT_SYM) {        if ((p = pre(tp->str, PT_DEF))) {            //if (debug) printf("def: preproc %s %s/n", p->str, tp->str);            if (debug) printf("DEF /"%s/" <- %d/n", tp->str, p->val);            tp->ttype = TT_NUM;            tp->num = p->val;            return 1;        }        if ((st = string_find(tp->str)) && (st->flags & SF_DEFINED)) {            if (debug) printf("SYM is now a defined LABEL /"%s/" <- 0x%x/n", tp->str, st->val);            tp->ttype = TT_NUM;            tp->num = st->val;            return 1;        }    }    return 0;}
开发者ID:yangkkokk,项目名称:Beagle_SDR_GPS,代码行数:40,


示例25: _libvfs_get_remote_host

/* libvfs_get_remote_host */static String * _libvfs_get_remote_host(char const * path){    char const file[] = "file://";    String * ret;    String * p;    if(path == NULL)        return NULL;    if(strncmp(file, path, sizeof(file) - 1) != 0)        return NULL;    path += sizeof(file) - 1;    if((ret = string_new(path)) == NULL)        return NULL;    if((p = string_find(ret, "/")) == NULL)    {        string_delete(ret);        return NULL;    }    *p = '/0';#ifdef DEBUG    fprintf(stderr, "DEBUG: %s(/"%s/") => /"%s/"/n", __func__, path, ret);#endif    return ret;}
开发者ID:DeforaOS,项目名称:VFS,代码行数:25,


示例26: expand_file

DllExport int call_conv expand_file(){char *file_name;char *expanded_file_name;int tlen, lose;struct passwd *pw;register char *new_dir, *p, *user_name;#ifdef MULTI_THREADif( NULL == th) th = xsb_get_main_thread();#endiffile_name = extern_ptoc_string(1);/* If file_name is absolute, flush ...// and detect /./ and /../.If no /./ or /../ we can return right away. */if (file_name[0] == '/')	{	p = file_name; lose = 0;	while (*p)		{		if (p[0] == '/' && p[1] == '/')			file_name = p + 1;		if (p[0] == '/' && p[1] == '~')			file_name = p + 1, lose = 1;		if (p[0] == '/' && p[1] == '.'				&& (p[2] == '/' || p[2] == 0				|| (p[2] == '.' && (p[3] == '/' || p[3] == 0))))			lose = 1;		p++;		}	if (!lose)		{		ctop_string(CTXTc 2, file_name);		return TRUE;		}	}/* Now determine directory to start with and put it in new_dir */new_dir = 0;if (file_name[0] == '~' && file_name[1] == '/')	/* prefix  ~/ */	{	if (!(new_dir = (char *) getenv("HOME")))		new_dir = "";	file_name++;	}else		/* prefix  ~username/ */	{	for (p = file_name; *p && (*p != '/'); p++);		user_name = alloca(p - file_name + 1);	bcopy (file_name, user_name, p - file_name);	user_name[p - file_name] = 0;		pw = (struct passwd *) getpwnam(user_name + 1);	if (!pw)		{		fprintf(stderr, "++Error: /"%s/" is not a registered user/n", user_name + 1);		ctop_string(CTXTc 2, file_name); /* return the input file name unchanged */		return TRUE;		}		file_name = p;	new_dir = pw -> pw_dir;	}/* Now concatenate the directory and name to new space in the stack frame */tlen = (new_dir ? strlen(new_dir) + 1 : 0) + strlen(file_name) + 1;expanded_file_name = alloca(tlen);if (new_dir) strcpy(expanded_file_name, new_dir);	strcat(expanded_file_name, file_name);/* Make sure you insert the newly created symbol into the symbol table. */ctop_string(CTXTc 2, string_find(expanded_file_name, 1));return TRUE;}
开发者ID:De-Lac,项目名称:Dynamic-Verification-of-Service-Based-Systems,代码行数:83,


示例27: string_find

int String::find(char ch, int pos /* = 0 */,                 bool caseSensitive /* = true */) const {  if (empty()) return -1;  return string_find(m_px->data(), m_px->size(), ch, pos,                     caseSensitive);}
开发者ID:silvajohnny,项目名称:hiphop-php,代码行数:6,



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


C++ string_format函数代码示例
C++ string_duplicate函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。