string

TCHAR end of line character

int DownloadFtpDirectory(TCHAR* DirPath) { WIN32_FIND_DATA FileData; UINT a; TCHAR* APP_NAME = TEXT("ftpcli"); TCHAR* f; int j = 5; do { j++; f = _tcsninc(DirPath, j); }while (_tcsncmp(f, TEXT("/"), 1)); TCHAR* PATH_FTP = wcsncpy(new TCHAR[j], DirPath, j); After the last line gets a string in which there is no line ending char...

Any ideas for developing a Risc Processor friendly string allocator?

I'm working on some tools to enable high throughput data-oriented development, and one thing that I've not got an immediate answer for is how you go about allocating strings quickly. On risc processors you've got another problem of implementation that the CPU doesn't like branching, which is what I'm trying to minimise or avoid. Also, ca...

strtod() and sprintf() inconsistency under GCC and MSVC

I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions: strtod() - string-to-double conversion sprintf() - when used for outputting double-precision floating point numbers) Their GCC and MSVC versions return different results, in some digits of mantissa. But it plays a...

Python, a smarter way of string to integer conversion

Hello I have written this code to convert string in such format "0(532) 222 22 22" to integer such as 05322222222 . class Phone(): def __init__(self,input): self.phone = input def __str__(self): return self.phone #convert to integer. def to_int(self): return int((self.phone).replace(" ","").repla...

Impact of Multiple .ToUpper()'ing

This is not a question of premature optimization per se. On the garbage collector and memory in general, what would hundreds of ToUpper() operations (many could be duplicated) do to a program, mainly in regard to the immutability of strings? ...

Replace in place, parsing & string manipulation.

I'm trying to replace a set of characters within a string. The string may or may not have any data to change. The string is marked up in a way that allows for it to change it's color from a set of characters. The string can reset it's formatting to default by using a defined set of characters. This setup is very much like the ECMA-48 st...

Comparing large strings in JavaScript with a hash

I have a form with a textarea that can contain large amounts of content (say, articles for a blog) edited using one of a number of third party rich text editors. I'm trying to implement something like an autosave feature, which should submit the content through ajax if it's changed. However, I have to work around the fact that some of th...

XamlReader.Parse throws exception on empty String

In our app, we need to save properties of objects to the same database table regardless of the type of object, in the form of propertyName, propertyValue, propertyType. We decided to use XamlWriter to save all of the given object's properties. We then use XamlReader to load up the XAML that was created, and turn it back into the value ...

jQuery trim function does not work in IE7?

I'm trying to call the jQuery text() function and run it through the trim() function to remove all trailing and leading whitespace. Seems to work great in Firefox, however, does not work in IE7 (refuses to remove a space trailing at the end). Any ideas?! Maybe a regex solution? ...

In C, how do I check if a String contains 2 digits, 1 letter and 4 digits?

In the method I've tried this: int 1, 2, 4, 5, 6, 7; char 3; char display[10]; scanf("%d%d%c%d%d%d%d", &1, &2, &3, &4, &5, &6, &7); display = {1, 2, 3, 4, 5, 6, 7}; But I get errors everywhere and it doesn't work. ...

Unicode strings in my C# App are shown with question marks

Hi, I have a header file in C++/CLI project, which contains some strings in different languages. arabic, english, german, chinese, french, japanese etc... I have a second project written in C#. Here I access the strings stored in the header file of the C++/CLI project. The encoding of the header file is Unicode - Codepage 1200 or UTF...

Proper indentation for Python multiline strings

What is the proper indentation for Python multiline strings within a function? def method(): string = """line one line two line three""" or def method(): string = """line one line two line three""" or something else? It looks kind of weird to have the string hanging outside the function in t...

String search and write into file in jython

hi Everyone , i wish to write a program that can read a file and if a particular str_to_find is found in a bigger string say AACATGCCACCTGAATTGGATGGAATTCATGCGGGACACGCGGATTACACCTATGAGCAGAAATACGGCCTGCGCGATTACCGTGGCGGTGGACGTTCTTCCGCGCGTGAAACCGCGATGCGCGTAGCGGCAGGGGCGATCGCCAAGAAATACCTGGCGGAAAAGTTCGGCATCGAAATCCGCGGCTGCCTGACCCAGATGGGCGACAT...

C++ string how to

This is a very simple question and I feel stupid for asking it, but I am pressed for time and I need to figure it out :) I just need to know how to make a string that contains text and other variables. For instance in Java I can just do this: String someString; for(int i = 0; i>10; i++){ someString = ("this text has printed " + i + ...

Is concatenating with an empty string to do a string conversion really that bad?

Let's say I have two char variables, and later on I want to concatenate them into a string. This is how I would do it: char c1, c2; // ... String s = "" + c1 + c2; I've seen people who say that the "" + "trick" is "ugly", etc, and that you should use String.valueOf or Character.toString instead. I prefer this construct because: I p...

Finding the string length of a integer in .NET

In .NET what is the best way to find the length of an integer in characters if it was represented as a string? e.g. 1 = 1 character 10 = 2 characters 99 = 2 characters 100 = 3 characters 1000 = 4 characters The obvious answer is to convert the int to a string and get its length but I want the best performance possible without the ove...

Findind string in another string in PHP

Hi everybody I got a string like this : $str1 = "mod 1 + mode 2 + comp 1 + toto" I would like to test even " mod 1" is in $str1. I used strpos but this function dosen't help Pliz can anyone give an idea to fix this problem thank u. ...

C++ printf: newline (\n) from commandline argument

How print format string passed as argument ? example.cpp: #include <iostream> int main(int ac, char* av[]) { printf(av[1],"anything"); return 0; } try: example.exe "print this\non newline" output is: print this\non newline instead I want: print this on newline ...

Is there an easy way to concatenate several lines of text into a string without constantly appending a newline?

So I essentially need to do this: String text = "line1\n"; text += "line2\n"; text += "line3\n"; useString( text ); There is more involved, but that's the basic idea. Is there anything out there that might let me do something more along the lines of this though? DesiredStringThinger text = new DesiredStringThinger(); text.append( "li...

Mixing Static Strings with Views Arguments

Hi. Can anyone tell me if it is possible to mix views arguments with static strings? For example in the path section of a view feed display I need: /mypath/%.xml with the ".xml" part being the static string. Thanks in advance. ...