Trivial I know, but just interested
I've got a stringbuilder variable, that I want to return the contents of, but if it's empty I want to return "|", so is it best to use stringbuilder.tostring in the compare statement e.g
If lReturnStringBuilder.ToString = String.Empty Then
lReturnStringBuilder.Append("|")
...
What is the recommended way of formatting TimeSpan objects into a string with a custom format?
...
Sometimes you need data for tests, like Adobe Thermo has prewritten "sets" of data, like 1-word strings, 3-word strings, etc for use in populating data controls.
I need:
Continuous text, no newlines
CSV Numbers, Integers
CSV Numbers, Decimals
URL encoded strings
Any ideas on how to get any of those?
...
I'm currently teaching myself Haskell, and I'm wondering what the best practices are when working with strings in Haskell.
The default string implementation in Haskell is a list of Char. This is inefficient for file input-output, according to Real World Haskell, since each character is separately allocated (I assume that this means tha...
I have a string in C++ of type EDIT: (const char *) passed as argument to strlen, but it returns void..
damn i can't get formatting to work >.<
it goes like
strlen(astruct.string);
Thanks..
EDIT: Did some checking,
strlen("test");
still gives void.. why?
EDIT: Here's the image
http://img14.imageshack.us/img14/1808/strlen.png
...
Ok the output is supposed to look like this:
./a 3 4 8 2
3
4
8
2
This is what I have so far, but I am lost and can only get the first integer to print (we have to use GetInt, which gets the specified integer in the string):
int main (int argc, char*argv []){
int v;
int i;
i = 1;
v = GetInt(argc, argv...
Hey all,
I have built a number of solutions in the past in which people enter data via a webform, validation checks are applied, regex in some cases and everything gets stored in a database. This data is then used to drive output on other pages.
I have a special case here where a user wants to copy/paste HUGE amounts of text (multiple...
I am creating a two-dimensional list that has consecutive numbers at the end of "day", for use as dataProvider for a DataGrid
i have been accessing them via the command
dg1.selectedItem.day1
dg1.selectedItem.day2
dg1.selectedItem.day3
etc...
is there any way to take the string ("day"+i) and convert it into a (what is it? variable name?)...
What is an easy way in Python to format integers into strings representing thousands with K, and millions with M, and leaving just couple digits after comma?
I'd like to show 7436313 as 7.44M, and 2345 as 2,34K.
Is there some % string formatting operator available for that? Or that could be done only by actually dividing by 1000 in a l...
Hey all,
I have a string ($string for this example) and I want to do the following: Parse the string and convert all links within it to "actual links" (adding the open/close anchor tag) -- what is the best way to do this? I tried using preg_split() to create an array of the links contained in the string, with the idea of using str_repl...
What is the best way to join a list of strings into a combined delimited string. I'm mainly concerned about when to stop adding the delimiter. I'll use C# for my examples but I would like this to be language agnostic.
EDIT: I have not used StringBuilder to make the code slightly simpler.
Use a For Loop
for(int i=0; i < list.Length; ...
I have the following statement
DateTime now = DateTime.Now;
string test = string.Format("{0}{1}{2}{3}", now.Day, now.Month, now.Year, now.Hour);
This gives me:
test = "242200915"
But I'd like to have something like:
test = "2402200915"
So the question is, how can I enforce the string formatter to output each int with the width ...
Here is the code
$i=0;
while ($row = mysql_fetch_array($result))
{
$output.="idno".$i."=".urlencode($row['usr_id']).
'&'."res".$i."=".urlencode($row['responce']).
'&'."sex".$i."=".urlencode($row['sex']).
'&'."com1".$i."=".urlencode($row['com1']).
'&'."com2".$i."=".urlencode($row['com2']);
$i++;
}
OUTPUT i get ...
In a previous question about formatting a double[][] to CSV format, Marc Gravell said that using StringBuilder would be faster than String.Join. Is this true?
...
How do you do case conversion in XSL?
<xsl:variable name="upper">UPPER CASE</xsl:variable>
<xsl:variable name="lower" select="???"/>
...
I am trying to expand the string $searchCriteria in the if condition. Any clues?
use strict;
my $argNum;
my $searchCriteria = "";
foreach $argNum (0 .. $#ARGV) {
$searchCriteria = $searchCriteria . "(\$_ =~ \/" . $ARGV[$argNum] . "\/i) && ";
}
$searchCriteria =~ s/&& $//;
#print $searchCriteria;
open IP, "<vm.txt" or die $!;
my ...
in delphi a string in contained within a pair of 's but i need to use ' in my string..
and when i use one it brings a end to the entire string identification...
'inside string ' but this bit is outside' inside again' and the end
is there some symbol that removes the coding affect of the next character?
...
is there a way to slice a string lets say i have this variable
$output=Country=UNITED STATES (US) &City=Scottsdale, AZ &Latitude=33.686 &Longitude=-111.87
i want to slice it in a way i want to pull latitude and longitude values in to seperate variables, subtok is not serving the purpose
...
We have a legacy database that uses strings as primary keys. I want to implement objects on top of that legacy database to better implement some business logic and provide more functionality to the user.
I have read in places that using strings for primary keys on tables is bad. I'm wondering why this is? Is it because of the case-se...
I created an info table that stores employee record, the SQL query for it as follows...
CREATE TABLE info1 (empid VARCcHAR(8)
PRIMARY KEY CONSTRAINT empchk CHECK
(empid IN ('kh\%' ESCAPE '\''),
initials CHAR(6), fname CHAR(25) NOT
NULL, lname CHAR(25), userstatus
INTEGER NOT NULL, designation CHAR(10)
NOT NULL);
Now, as...