I'm making some pretty string-manipulation-intensive code in C#.NET and got curious about some Joel Spolsky articles I remembered reading a while back:
http://www.joelonsoftware.com/articles/fog0000000319.html
http://www.joelonsoftware.com/articles/Unicode.html
So, how does .NET do it? Two bytes per char? There ARE some Unicode chars^H...
Pseudo Code
text = "I go to school";
word = "to"
if ( word.exist(text) ) {
return true ;
else {
return false ;
}
I am looking for a PHP function which returns true if the word exists in the text.
...
In a string that includes quotes, I always get an extra whitespace before the end quote. For instance
"this is a test " (string includes quotes)
Note the whitespace after test but before the end quote. How could I get rid of this space?
I tried rtrim but it just applies for chars at the end of the string, obviously this case is n...
I have
TextBoxD1.Text
and I want to convert it to 'int' to store it in a database. How can I do this?
...
I know this is simple, but how do you take a string and convert it to lower case, or upper case in ruby.
...
I receive as input a list of strings and need to return a list with these same strings but in randomized order. I must allow for duplicates - same string may appear once or more in the input and must appear the same number of times in the output.
I see several "brute force" ways of doing that (using loops, god forbid), one of which I'm ...
In trying to capitalize a string at separators I encountered behavior I do not understand. Can someone please explain why the string s in reverted during the loop? Thanks.
s = 'these-three_words'
seperators = ('-','_')
for sep in seperators:
s = sep.join([i.capitalize() for i in s.split(sep)])
print s
print s
stdo...
What is the best way to get the full String representation of an HTMLCollection object in javascript/jquery? The output String should have an XML syntax.
...
I have string like
\LESSING\root\cimv2:Win32_UserAccount.Domain="LESSING",Name="Admin"
How to convert it to LESSING\Admin using Framework?
...
Let's say you have a database with a single table like...
---------------------------------------------
| Name | FavoriteFood |
---------------------------------------------
| Alice | Pizza |
| Mark | Sushi |
| Jack | Pizza |
----...
I found a Windows API function that performs "natural comparison" of strings. It is defined as follows:
int StrCmpLogicalW(
LPCWSTR psz1,
LPCWSTR psz2
);
To use it in delphi, I declared it this way:
interface
function StrCmpLogicalW(psz1, psz2: PWideChar): integer; stdcall;
implementation
function StrCmpLogicalW; e...
I have a string that has HTML & PHP in it, when I pull the string from the database, it is echo'd to screen, but the PHP code doesn't display. The string looks like this:
$string = 'Hello <?php echo 'World';?>';
echo $string;
Output
Hello
Source Code
Hello <?php echo 'World';?>
When I look in the source code, I can s...
Hi,
Is there any way to determine a string's encoding in C#?
Say, I have a filename string, but I don't know if it is encoded in Unicode UTF-16 or the system-default encoding, how do I find out?
Thanks,
kreb
...
I'm building a MySql query that batch inserts 4096 records at once. The actual insert is quite fast but the bottleneck is generating the query. Any hints on optimizing this? The string generation is currently taking about 18 times longer than the query.
let builder = StringBuilder(524288)
Printf.b...
Possible Duplicates:
Why does simple C code receive segmentation fault?
Modifying C string constants?
Why does this code generate an access violation?
int main()
{
char* myString = "5";
*myString = 'e'; // Crash
return 0;
}
...
Hi, we faced very strange issue (really strange for such mature product):
how to get number of characters in unicode string using Transact-SQL statements.
The key problem of this issue that the len() TSQL function returns number of chars, excluding trailing blanks. the other variant is to use datalength (which return number of bytes) and...
I have a list that I want to print:
foo: list of string;
I want to create a string bar that is the concatenation of the elements of foo. In Perl I would do:
$bar = join " ", @foo;
The only way I can think of to do this in specman is:
var bar: string = "";
for each in foo {
bar = appendf("%s %s", bar, it);
};
This seems like...
I want to capitalize the first character of a string, and not change the case of any of the other letters. For example:
this is a test -> This is a test
the Eiffel Tower -> The Eiffel Tower
/index.html -> /index.html
...
I'm having trouble comparing strings in C (with which I am fairly new to). I have socket on this server application waiting to accept data from a client. In this particular portion of my program I want to be able to execute a MySQL query based on the data received from the client. I want to be able to know when the received data has the ...
I'm reviewing a collegue's code, and I see he has several constants defined in the global scope as:
const string& SomeConstant = "This is some constant text";
Personally, this smells bad to me because the reference is referring to what I'm assuming is an "anonymous" object constructed from the given char array.
Syntactically, it's le...