In php, I have a string like this:
$string = "[email protected] MIME-Version: bla bla bla";
How do i get the email address only? Is there any easy way to get the value??
EDIT:
THANKS guys. Using regular expression solved my problem. You guys are the BEST!!
...
Using jQuery how would I find/extract the "Spartan" string if the outputted HTML page had the following..
<a href="/mytlnet/logout.php?t=e22df53bf4b5fc0a087ce48897e65ec0">
<b>Logout</b>
</a> : Spartan<br>
...
Hi,
I'm using C# to continuously search for multiple string "keywords" within large strings, which are >= 4kb. This code is constantly looping, and sleeps aren't cutting down CPU usage enough while maintaining a reasonable speed. The bog-down is the keyword matching method.
I've found a few possibilities, and all of them give similar e...
I'm trying to use std::string instead of char* whenever possible, but I worry I may be degrading performance too much. Is this a good way of returning strings (no error checking for brevity)?
std::string linux_settings_provider::get_home_folder() {
return std::string(getenv("HOME"));
}
Also, a related question: when accepting stri...
In PHP
I have a string, how do I convert it to an array?
After manipulating that array, how do I again make it into a string?
Do strings in PHP behave the same way as in Java?
is there a dupe for this?
thanks in advance
...
Hello!
Could someone please give an example of how to use ling to query over a long string of text and find a substring within that string?
regards
...
Seems like a fairly straightforward problem. I want to look through about 6gb of content and classic asp code and find anything that looks like a connection string. Problem is, the connection strings are formatted in a dozen different ways.
I was thinking of using a regex to look for specific properties like "catalog=" or "password=" ...
I'm looking for the name of the following class of problem, so that I can google for effective algorithms and more information.
I have an alphabet with three characters {-1, 0, 1}.
I need to effectively generate all strings of length 24 which are mostly {0} but have zero to eight {1,-1} characters distributed in certain patterns. (The...
I have a large block of text (200+ characters in a String) and need to insert new lines at the next space after 30 characters, to preserve words. Here is what I have now (NOT working):
String rawInfo = front.getItemInfo(name);
String info = "";
int begin = 0;
for(int l=30;(l+30)<rawInfo.length();l+=30) {
while(rawInfo.charAt(l)!=' '...
I'm creating a theme for a CMS, and only have the ability to change the CSS associated with the page (no Javascript, PHP, etc).
Is there a way to change this list of users that we have:
JOHN SMITH DAVID JONES ...
into proper title case (John Smith, etc) using CSS?
text-transform: lowercase; works ok (john smith, etc) but text-tra...
Hello!
I have a string = "google.com 220 USD 3d 19h".
I want to extract just the ".com" part.......
whats the easiest way to manipulate the split string method to get this result?
...
What is the most idiomatic way to do the following?
def xstr(s):
if s is None:
return ''
else:
return s
s = xstr(a) + xstr(b)
update: I'm incorporating Tryptich's suggestion to use str(s), which makes this routine work for other types besides strings. I'm awfully impressed by Vinay Sajip's lambda suggestion, ...
Given two strings text1 and text2
public SOMEUSABLERETURNTYPE Compare(string text1, string text2)
{
// DO SOMETHING HERE TO COMPARE
}
Examples:
First String: StackOverflow
Second String: StaqOverflow
Return: Similarity is 91%
The return can be in % or something like that.
First String: The simple text test
Second String: Th...
In other .NET languages such as C# you can switch on a string value:
string val = GetVal();
switch(val)
{
case "val1":
DoSomething();
break;
case "val2":
default:
DoSomethingElse();
break;
}
This doesn't seem to be the case in C++/CLI
System::String ^val = GetVal();
switch(val) // Compile error
{
// Snip
}
Is there a sp...
Is there a way to convert integers to string in PHP?
...
I want to use my dictionary keys for output in a grouped table. This has to be localized with all my other content. Can I use an NSLocalizedString as the key?
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
first_array, NSLocalizedString(@"First Array", @"The First Array"),
second_array, NSLocalizedString(@"Seco...
Hey folks,
This ought to be pretty simple, maybe use a regex but I would think there is an easier - faster way. Currently I make this work by using a couple of splits, but that sure seems like a poor method.
Example string:
on Jun 09, 2009. Tagged:
What I need to do is turn that date (June 09, 2009) into three strings (Jun, 09, ...
How does one compare single character strings in Perl? Right now, I'm tryin to use "eq":
print "Word: " . $_[0] . "\n";
print "N for noun, V for verb, and any other key if the word falls into neither category.\n";
$category = <STDIN>;
print "category is...." . $category . "\n";
if ($category eq "N")
{
print "N\n";
push (@nouns...
How do I check if the charset of a string is UTF8?
...
I want to make sure that _content does not end with a NewLine character:
_content = sb.ToString().Trim(new char[] { Environment.NewLine });
but the above code doesn't work since Trim seems to not have an overloaded parameter for a collection of strings, only characters.
What is the simplest one-liner to remove an Enivronment.Newline ...