Somehow I can't seem to get string replacement within a foreach loop in C# to work. My code is as follows :
foreach (string s in names)
{
s.Replace("pdf", "txt");
}
Am still quite new to LINQ so pardon me if this sounds amateurish ;)
...
How can I find the last word from any particular cell in excel sheet if cell contains multiple words or instructions?
For ex- The below string is in particular cell:
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg
My requirement is to search only last word in that cell i.e. Blue hills.jpg.
...
I am trying to take a block of text and scan it for specific text (name) and turn it into a URL, specifically:
Block of text:
Chairman Joe Smith has announced a new plan to decrease expenditures by outsourcing the planning of the new dining hall. Smith states the current project managers do not have excess time to commit to this new pr...
After considerable measurement, I have identified a hotspot in one of our windows services that I'd like to optimize. We are processing strings that may have multiple consecutive spaces in it, and we'd like to reduce to only single spaces. We use a static compiled regex for this task:
private static readonly Regex
regex_select_all_...
Is there a way to get all format parameters of a string?
I have this string: "{0} test {0} test2 {1} test3 {2:####}"
The result should be a list:
{0}
{0}
{1}
{2:####}
Is there any built in functionality in .net that supports this?
...
I'm having some issues with a regular expression I'm creating.
I need a regex to match against the following examples and then sub match on the first quoted string:
Input strings
("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
('Lorem ipsum dolor sit amet, consectetur adipiscing elit. ')
('Lorem ipsum dolor sit amet, co...
I have a string which is beginning with zeros:
string s = "000045zxxcC648700";
How can I remove them so that string will look like:
string s = "45zxxcC648700";
...
Dear experts,
I came across an block of Javascript code to split a paragraph with the dom structure.
The code is as follows:
string.split("<b" + "r>");
I am a little confused as to why do they have to use a PLUS SIGN and split the parameter into lookup strings?
Why not just use
string.split("<br>");
Is there a technique or bro...
I have no clue why strtok decided to break on me. Here is my code. I am tokenizing a string by dollar symbol $.
echo 'Tokenizing this by $: ',$aliases,PHP_EOL;
if(strlen($aliases) > 0)
{
//aliases check
$token = strtok($aliases, '$');
while($token != NULL)
{
echo 'Found a token: ',$token,PHP_EOL;
if(!isGo...
I have a list of
uids: ['1234','4321','1111']
and I would like to turn this into a single string of:
"uid = '1234' OR uid = '4321' OR uid = '1111'"
What's the most efficient way to do this?
Thanks!
...
A multi-line string, e.g.
abc 123
456 def
wanted result (ordinal + 2):
cde 345
678 fgh
if I use:
text = "abc 123\n456 def"
add2=''.join(chr(ord(c)+2) for c in text)
print text
print add2
the space and \r \n will also be replaced, how can I add the exception of not including space, \r or \n in the 2nd line of code.
p.s. it's fol...
if I want to construct a const char * out of several primitive type arguments, is there a way to build the string using a similar to the printf?
...
Hello,
I need to split long string into a array with following constrains:
The input will be HTML string, may be full page or partial.
Each part (new strings) will have a limited number of character (e.g. not more than 8000 character)
Each part can contain multiple sentences (delimited by . [full stop]) but never a partial sentences. ...
I have a string and i want to find the position of all the occurrences of multiple spaces. Im writing a punctuation checker. I would like to parralelise this operation using parallel linq but in the meantime im just looking for the linq method to get me started.
...
Hi,
let's say i have the following:
$vars="name=david&age=26&sport=soccer&birth=1984";
I want to turn this into real php variables but not everything. By example, the functions that i need :
$thename=getvar($vars,"name");
$theage=getvar($vars,"age");
$newvars=cleanup($vars,"name,age"); // Output $vars="name=david&age=26"
How can i ...
i have $date variable 2009-04-29 which is Y-m-d
anybody can give idea how to extract into $d, $m, $y using simplest method as possible?
regex is preferable.
any more suggestion with simple method will be chosen. :)
...
How can I add a trailing slash (/ for *nix, \ for win32) to a directory string, if the tailing slash is not already there? Thanks!
...
I have an issue with some Arabic text where I need to flip numbers inside a string. So this:
"Some text written in 1982 by someone with m0123456 or 12-to-13"
Should become:
"Some text written in 2891 by someone with m6543210 or 21-to-31"
A regex solution will be great. The more optimized for large strings the better.
Any hints?
...
HI,
I want to dynamically concatenating the strings using C#. I have localized string in XML file , this string i want to update based on the language selection at runtime.
Below i specified input string and expected output string formats.
EX:
*Input String:*
"The density of your %s gas at reference conditions of %s %s ...
<div id="rssConsumer" style="width:100%; border:1px solid #e8e8e8; margin:0px 0px 15px 0px;"><div style="margin:8px 10px 8px 10px; font-weight:bold; font-size:1.4em;">Recent Tweets</div>
<cffeed action="read" source="http://twitter.com/statuses/user_timeline/7717612.rss" name="tweetfeed">
</cffeed>
<cfloop from="1" to="3" ...