这篇教程C++ string_replace函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中string_replace函数的典型用法代码示例。如果您正苦于以下问题:C++ string_replace函数的具体用法?C++ string_replace怎么用?C++ string_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了string_replace函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: HHVM_FUNCTIONbool HHVM_FUNCTION(mail, const String& to, const String& subject, const String& message, const String& additional_headers /* = null_string */, const String& additional_parameters /* = null_string */) { // replace /0 with spaces String to2 = string_replace(to, s_zero, s_space); String subject2 = string_replace(subject, s_zero, s_space); String message2 = string_replace(message, s_zero, s_space); String headers2; if (!additional_headers.empty()) { headers2 = string_replace(additional_headers, s_zero, s_space); } String params2; if (!additional_parameters.empty()) { params2 = string_replace(additional_parameters, s_zero, s_space); } to2 = php_trim(to2); subject2 = php_trim(subject2); if (!RuntimeOption::MailForceExtraParameters.empty()) { params2 = string_escape_shell_cmd( RuntimeOption::MailForceExtraParameters.c_str()); } else { params2 = string_escape_shell_cmd(params2.c_str()); } return php_mail(to2, subject2, message2, headers2, params2);}
开发者ID:shixiao,项目名称:hhvm,代码行数:32,
示例2: ResourceDotHFile ResourceDotHFile(const char * file) { assert(file != NULL); CCFileData data(GameResourceManager::sharedManager()->storedFullPathFromRelativePath(file), "rb"); const char* buffer = (const char*)data.getBuffer(); std::string strBuffer(buffer); std::stringstream ss(stringstream::in | stringstream::out); ss << strBuffer<<"/r/n"; do { // read the file from hardware char strTemp[1024]; std::string strVal; while(!ss.eof()) { strTemp[0] = '/0'; ss.getline(strTemp, 1024); //CCLog("line : %s", strTemp); strVal = strTemp; string_replace(strVal, "/r/n", ""); string_replace(strVal, "/t" ," "); string_tripleft(strVal); std::string split = " "; int i0 = strVal.find_first_of(split); if (-1 == i0) continue; std::string def = strVal.substr(0, i0); strVal = strVal.substr(i0, strVal.length() - i0); string_tripleft(strVal); int i1 = strVal.find_first_of(split); if (-1 == i1) continue; std::string macro = strVal.substr(0, i1); std::string val = strVal.substr(i1, strVal.length() - i1); string_tripleft(val); if (def.empty() == false && val.empty() == false && def.compare("#define") == 0 && val.length() > 0) { string_replace(macro, " ", ""); string_replace(val, " ", ""); m_mapMacro2Value[macro] = atoi(val.c_str()); } //CCLog("key : %s = Value %s/n", macro.c_str(), val.c_str()); } } while (0); }
开发者ID:niuzb,项目名称:hellopet,代码行数:59,
示例3: EscapeXML/** * @brief Covert characters that are unsafe for use in XML * @param [in] str The string to be converted * @return The converted string */static String EscapeXML(const String &str){ String escapedStr = str; string_replace(escapedStr, _T("&"), _T("&")); string_replace(escapedStr, _T("<"), _T("<")); string_replace(escapedStr, _T(">"), _T(">")); return escapedStr;}
开发者ID:seanedwards,项目名称:COS-420,代码行数:13,
示例4: string_remove_trademarkstring string_remove_trademark(const string &s){ string result = s; string_replace(result, "(TM)", ""); string_replace(result, "(R)", ""); return string_strip(result);}
开发者ID:Aligorith,项目名称:blender,代码行数:8,
示例5: line_directivestatic string line_directive(const string& path, int line){ string escaped_path = path; string_replace(escaped_path, "/"", "///""); string_replace(escaped_path, "/'", "///'"); string_replace(escaped_path, "/?", "///?"); string_replace(escaped_path, "//", "////"); return string_printf("#line %d /"%s/"", line, escaped_path.c_str());}
开发者ID:UPBGE,项目名称:blender,代码行数:9,
示例6: cmd_mount/****************************************************************************mount smbfs****************************************************************************/static void cmd_mount(char *inbuf,char *outbuf){ pstring mpoint; pstring share_name; pstring mount_command; fstring buf; int retval; char mount_point[MAXPATHLEN+1]; if (!next_token(NULL, mpoint, NULL)) { DEBUG(0,("You must supply a mount point/n")); return; } memset(mount_point, 0, sizeof(mount_point)); if (realpath(mpoint, mount_point) == NULL) { DEBUG(0, ("Could not resolve mount point/n")); return; } /* * Build the service name to report on the Unix side, * converting '/' to '/' and ' ' to '_'. */ pstrcpy(share_name, service); string_replace(share_name, '//', '/'); string_replace(share_name, ' ', '_'); slprintf(mount_command, sizeof(mount_command)-1,"smbmnt %s -s %s", mount_point, share_name); while(next_token(NULL, buf, NULL)) { pstrcat(mount_command, " "); pstrcat(mount_command, buf); } DEBUG(3, ("mount command: %s/n", mount_command)); /* * Create the background process before trying the mount. * (We delay closing files to allow diagnostic messages.) */ daemonize(); /* The parent has exited here, the child handles the connection: */ if ((retval = system(mount_command)) != 0) { DEBUG(0,("mount failed/n")); exit(1); } send_fs_socket(mount_point, inbuf, outbuf);}
开发者ID:earthGavinLee,项目名称:hg556a_source,代码行数:58,
示例7: string_remove_trademarkstring string_remove_trademark(const string &s){ string result = s; /* Special case, so we don;t leave sequential spaces behind. */ /* TODO(sergey): Consider using regex perhaps? */ string_replace(result, " (TM)", ""); string_replace(result, " (R)", ""); string_replace(result, "(TM)", ""); string_replace(result, "(R)", ""); return string_strip(result);}
开发者ID:Ichthyostega,项目名称:blender,代码行数:14,
示例8: _expand_stringstatic 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,
示例9: string_replace_allchar *notification_fix_markup(char *str){ char *replace_buf, *start, *end; if (str == NULL) { return NULL; } str = string_replace_all(""", "/"", str); str = string_replace_all("'", "'", str); str = string_replace_all("&", "&", str); str = string_replace_all("<", "<", str); str = string_replace_all(">", ">", str); /* remove tags */ str = string_replace_all("<b>", "", str); str = string_replace_all("</b>", "", str); str = string_replace_all("<br>", " ", str); str = string_replace_all("<br/>", " ", str); str = string_replace_all("<br />", " ", str); str = string_replace_all("<i>", "", str); str = string_replace_all("</i>", "", str); str = string_replace_all("<u>", "", str); str = string_replace_all("</u>", "", str); str = string_replace_all("</a>", "", str); while ((start = strstr(str, "<a href")) != NULL) { end = strstr(start, ">"); if (end != NULL) { replace_buf = strndup(start, end - start + 1); str = string_replace(replace_buf, "", str); free(replace_buf); } else { break; } } while ((start = strstr(str, "<img src")) != NULL) { end = strstr(start, "/>"); if (end != NULL) { replace_buf = strndup(start, end - start + 2); str = string_replace(replace_buf, "", str); free(replace_buf); } else { break; } } return str;}
开发者ID:vivien,项目名称:dunst,代码行数:50,
示例10: run_fontsel_settings_dlgstatic voidrun_fontsel_settings_dlg(SettingsWidget *sw) { GtkWidget *dlg; const gchar *newfont; gchar *oldfont; dlg = gtk_font_selection_dialog_new(_("Select font")); gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dlg), gtk_label_get_text(GTK_LABEL(sw->widget))); if (gtk_dialog_run(GTK_DIALOG(dlg)) == GTK_RESPONSE_OK) { gtk_label_set_text(GTK_LABEL(sw->widget), gtk_font_selection_dialog_get_font_name( GTK_FONT_SELECTION_DIALOG(dlg))); } newfont = gtk_label_get_text(GTK_LABEL(sw->widget)); oldfont = pango_font_description_to_string( pango_context_get_font_description( gtk_widget_get_pango_context(GTK_WIDGET(sw->data)))); if (newfont && g_ascii_strcasecmp(oldfont, newfont) != 0) { string_replace(sw->conf, g_strdup(newfont)); jam_widget_set_font(sw->widget, newfont); jam_widget_set_font(sw->data, newfont); } g_free(oldfont); gtk_widget_destroy(dlg);}
开发者ID:nightmorph,项目名称:LogJam,代码行数:31,
示例11: gkd_dbus_introspect_handleDBusMessage *gkd_dbus_introspect_handle (DBusMessage *message, const gchar *data, const gchar **children){ DBusMessage *reply; GString *output = NULL; gchar *nodes; g_return_val_if_fail (message, NULL); g_return_val_if_fail (data, NULL); if (dbus_message_is_method_call (message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") && dbus_message_get_args (message, NULL, DBUS_TYPE_INVALID)) { if (children != NULL) { output = g_string_new (data); nodes = build_child_node_xml (dbus_message_get_path (message), children); if (!string_replace (output, "<[email C++ string_set_add函数代码示例 C++ string_printf函数代码示例
|