Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
str-replace
- Page 1
Re: RegEx to wrap words in HTML
Programming
Software Development
3 Weeks Ago
by samzz
…;); //Previous one had mistake var
str
=document.getElementById("
str
").textContent; //Not .innerHTML var res=
str
.
replace
(rex,"<u>$1…
Comparing Fine-tuned and Default GPT-3.5 Turbo for Text Classification
Programming
Computer Science
1 Week Ago
by usmanmalik57
… 'text' are empty strings dataset = dataset[(dataset['airline_sentiment'].
str
.strip() != '') & (dataset['text'].
str
.strip() != '')] # Filter the DataFrame for each sentiment… as shown in the following script: ``` api_key = "YOUR_OPEN_AI_API_KEY" #
replace
this with your OpenAI API key" client = OpenAI(api_key…
Re: Replace Function, Please Help!!!!!
Programming
Software Development
15 Years Ago
by Teme64
…CODE] Here's an example [CODE]Dim
str
As String
str
= "ABC"
str
=
Replace
(
str
, "b", "x"… and vbBinaryCompare is the default compare method in VB6 [CODE]
str
=
Replace
(
str
, "b", "x", , , …put a breakpoint in the line [CODE]strResult =
Replace
(strRTF, Mystring3, strHex3)[/CODE] what would strRTF, …
Re: replace text between to substrings
Programming
Web Development
10 Years Ago
by nouth
I mean
replace
text between two known strings but you don't know what any of the text in the middle is like this. var
str
= "abcdefghijklmnopqrstuvwxyz"; var start = "def"; var end = "nop";
str
=
str
.
replace
(
str
.substring(
str
.indexOf(start)+start.length,
str
.lastIndexOf(end)), '*'); alert(
str
);
Re: Replace last occurence of a substring from a string
Programming
Web Development
13 Years Ago
by Taywin
…. :) @kalleanka Use regular expression and
replace
() function. [CODE] var
str
= "xxx, yyy, zzz, sss,";
str
=
str
.
replace
(/,\s*(\w+),\s*$/, "and $1…;) // Done! Case for any more than 1 -> xxx, yyy,
str
=
str
.
replace
(/,\s*$/, "") // Done! Case for only 1 appear ->…
Re: replace text between to substrings
Programming
Web Development
10 Years Ago
by AndrisP
`var a =
str
.
replace
(/error/,'my
replace
')` or `
str
.
replace
(/anything.*anything/,'anything my
replace
anything')` if I understand correctly
Re: replace text between to substrings
Programming
Web Development
10 Years Ago
by nouth
no i mean something like `
str
=
str
.
replace
(
str
.substring(
str
.indexOf(a)+a.length,
str
.lastIndexOf(a)), 'whatever')`
Re: Replace special characters (E.G. * with %2A)
Programming
Software Development
14 Years Ago
by Ancient Dragon
[code] #include <iostream> #include <string> using namespace std; int main() { string
str
= "Hello*World";
str
.
replace
(5,1,"%2A"); cout <<
str
<< "\n"; } [/code]
Re: Replace a character via its ASCII code...
Programming
Web Development
11 Years Ago
by theHop
How about
str
=
str
.
replace
(/\u0160/g,"");
Re: Problem with replace characters
Programming
Software Development
14 Years Ago
by bufospro
…(counter_k > counter_x)
str
=
str
.
replace
('k', 'x'); else if (counter_x > counter_k)
str
=
str
.
replace
('x', 'k'); else
str
="FALSE"; return
str
; } public static void…
Problem with replace characters
Programming
Software Development
14 Years Ago
by bufospro
…is bigger than the x number, and the opposite
replace
. My code is : [CODE] class Replacing_class … counter_x)
str
.
replace
('k', 'x'); else if (counter_x > counter_k)
str
.
replace
('x', 'k'); else
str
="FALSE"; return
str
; }…
Re: Problem with replace characters
Programming
Software Development
14 Years Ago
by masijade
Because Strings are immutable. You cannot change it's content, you can only create a new String containing modified content, so [code]
str
.
replace
('x', 'k');[/code] should, of course, be [code]
str
=
str
.
replace
('x', 'k');[/code]
String Array Replace Problem
Programming
Software Development
13 Years Ago
by Jesi523
…Length; i++ ) { if(
str
.Contains(chars[i])) {
str
=
str
.
Replace
(chars[i].ToString(),""); } } return
str
.ToSting(); } [/CODE] Then…does not contain a definition for '
Replace
' and no extension method '
Replace
' accepting a first argument of type…
Vigenere, Str
Programming
Software Development
13 Years Ago
by hbluthi
…py from graphics import * def encode(message, key):
str
.upper(message)
str
.upper(key)
str
.
replace
(message, " ", "") encodedMessage… ## key = "CABCABCABCABCABCABCABCAB" ##
str
.
replace
(message, " ", "") ##
str
.upper(message) ##
str
.upper(key) ## key = key1 * (len…
preg replace bugs
Programming
Web Development
15 Years Ago
by cwarn23
… language). So to do that I am using mainly preg
replace
and
str
replace
. I have been working hard at it for the… last 29 hours but there is just three bugs (or preg
replace
…#>$3($4)</font>$5',$textb); // one preg
replace
that works was taken out from this spot. $textb=preg_replace…
JavaScript string.replace *
Programming
Web Development
11 Years Ago
by nouth
…;. I want to do something like `
str
=
str
.
replace
("bc*x","");` or `
str
=
str
.
replace
("bc"*"x","…
Javascript Replace Case Insensitive preserve capitalization
Programming
Web Development
11 Years Ago
by JySysAdmin
… a blue house and a blue car"; var n=
str
.
replace
(/blue/gi, "red"); And the result of N…
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by tpickett
…'race car driver', 'racing', 'race team' );//array to
replace
$match with $search = "text"; //keyword to …"3"; //number of times to
replace
in artcle $
str
= 'this is example text. it has …text. wouldnt you like to
replace
this text…
Re: c++ Replace text in a .txt file
Programming
Software Development
9 Years Ago
by latrodectuss.imvu
…quot;; ifstream fails; string text; string text2; std::string
str
(text); std::string str2 (text2); fails.open("teksts… cout << "
Replace
with the word: "; cin >> text2;
str
.
replace
(
str
.find(text),text.length(), text2…
Re: Another str replace question
Programming
Web Development
12 Years Ago
by diafol
…qacjk"; echo preg_replace("/[\D]+)/","",$
str
);[/CODE] You don't state whether you want …5678/qacjk"; $r = array_filter(preg_split("/[\D]+/",$
str
)); print_r($r);[/CODE] But just in case, you can… do this: [CODE]$
str
= "//abdhBw/1234/acl0jk/5678/qacjk"; preg_match_all("…
Re: Find and replace one instance of a string in a file
Programming
Software Development
14 Years Ago
by Gribouillis
Use the interpreter ! [code=python] >>> help(
str
.
replace
) Help on method_descriptor:
replace
(...) S.
replace
(old, new[, count]) -> string Return a copy of string S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced. [/code]
Re: PHP Replace newline with BR
Programming
Web Development
12 Years Ago
by GreenDay2001
Check out `str_replace()` function (see [here](http://www.php.net/manual/en/function.
str
-
replace
.php))
Re: Another str replace question
Programming
Web Development
12 Years Ago
by bipies
… value and also length, I "simply" need to
replace
the content between the slashes with "" (I mean…
replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by tpickett
…position would get array value 3. etc... public function replace_random ($
str
, $search, $
replace
, $n) { // Get all occurences of $search and … $n); foreach ($toReplace as $match) { $
str
= substr($
str
, 0, $matches[0][$match][1] + $offset).$
replace
[$arrayNum].substr($
str
, $matches[0][$match][1] + $searchLen + …
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by LastMitch
… match n = "3"; //number of times to
replace
in artcle $
str
= 'this is example text. it has text. wouldnt you…], $n); foreach ($toReplace as $match) { $
str
= substr($
str
, 0, $matches[0][$match][1] + $offset).$
replace
[$arrayNum].substr($
str
, $matches[0][$match][1] + $searchLen + $offset…
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by LastMitch
**@tpickett** >I have the script working as it should, however I need to be able to have an array of "replacements" for the function to loop through and insert at the random location. I don't understand what you are trying to do? You didn't show the array? Which of these are the array: `$
str
, $search, $
replace
, $n`?
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by tpickett
… with differen't values(chosen at random from the $
replace
array). It currently outputs only 1 value for all …matches. my original attempt is this part: $searchCount = count($
replace
); $arrayNum = mt_rand(0, 4);//the last parameter should be… $
replace
, but i set staic values trying to get it…
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by tpickett
the $n makes sure that the function doesn't
replace
more that what was set to be replaced. So if I have a string with 6 matches of $search, and $n is set to 3, then the function only replaces 3 of those 6 matches at random.
Re: replace $v in a string with a random replacement
Programming
Web Development
11 Years Ago
by tpickett
i figured it out by adding in this line: $replaceRand = $
replace
[array_rand($
replace
)]; into the foreach loop. Thanks for your help!
Re: Replace a substring by a new substring (makes pointer of integer withou a cast)
Programming
Software Development
12 Years Ago
by Narue
…;strlen(orig); i++) res[i]=
str
[i]; } else { strncpy(buffer,
str
, p-
str
); buffer[p-
str
] = '\0'; sprintf(buffer+(p-
str
), "%s%s"… the first occurance of s2 in s1 and it should
replace
all.[/QUOTE] Well, you only call strstr() once, so that…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC