string

String Compare Library

Hi, I am looking for a Java 5 lbrary which let me compare some text as following lines returns true: " foo bar " == "foo bar" "foo\nbar" == "foo bar" "foo\tbar" == "foo bar" "féé bar" == "fee bar" and so on... Any suggestions? ...

Scala Raw Strings: Extra tabs at the start of each line

I'm using a raw strings but when I print the string I'm getting extra tabs at the start of each line. val rawString = """here is some text and now im on the next line and this is the thrid line, and we're done""" println(rawString) this outputs here is some text and now im on the next line and this is the thrid line, and we'...

C#: How to simplify this string-of-numbers-to-various-date-parts-code

I have a string that might be between 1 and 8 characters long. I need to convert those into a day, a month and a year. For missing parts I will use the current one. The code I have now is kind of big and ugly, and I was wondering if someone have a more clever idea on how to do this. My current code is listed below: var day = DateTime....

Use Oracle INSTR function to search for multiple strings

In Oracle/PLSQL, the instr function returns the location of a substring in a string. If the substring is not found, then instr will return 0. I want to search multiple substrings in a string and return the first non-zero value. This can be acheived using regexp_instr, but I'd like a non-regexp_ solution. Example: regexp_instr('500 Or...

Split string in Ruby, ignoring contents of parentheses?

I need to split a string into a list of parts in Ruby, but I need to ignore stuff inside paramentheses. For example: A +4, B +6, C (hello, goodbye) +5, D +3 I'd like the resulting list to be: [0]A +4 [1]B +6 [2]C (hello, goodbye) +5 [3]D +3 But I can't simply split on commas, because that would split the contents of the parentheses...

JQUERY, Extract only the first paragraph

Given a block of text in a TEXT EDITOR (CKEDITOR), with paragraphs contained in PARAGRAPH tags, how can I do in JQUERY to extract only the first paragraph Example: blah blah blah blah blah blah blah blah 123123blah blah blah blah blah blah b1212lah blah blah blah blaasdasdadsh blah To Just: blah blah blah blah blah Thanks ...

Does Java have the '@' character to escape string quotes?

My string has double quotes in it, in C# I would do: string blah = @"this is my ""text"; how would I do that in Java? ...

fprintf with string argument

Dear all, In order to creation a formatted file, I want to utilize fprintf. it must get char* but I have several string variables. Can anyone help me, please? Thanks ...

C# string formatting and padding

Seems like this should be something straightforward, but I haven't been able to get it right. I've looked at http://idunno.org/archive/2004/14/01/122.aspx for reference. Example: I would like to print a table of double values, with each double output having 3 decimal precision, and take up 10 spaces (left aligned). Conceptually, I tried...

Access random item in list.

Hi All, I have an ArrayList, and I need to be able to click a button and then randomly pick out a string from that list and display it in a messagebox. How would I go about doing this? Any help at all is greatly appreciated. Thank you Bael ...

VS2008 exe-VC6 dll interoperability

Hi folks, I heard somewhere that passing of wchar_t across VS2005 and VC6 is quite dangerous. I tried to delete memory which was allocated from VC6 dll from VS2008 exe, and it raised assertion. After referring http://stackoverflow.com/questions/1175330/bad-pointer-or-link-issue-when-creating-wstring-from-vc6-dll, i added one func in VC6...

stick integer to string and char*

Dear all, How can I add an integer variable to a string and char* variable? for example: int a = 5; string St1 = "Book", St2; char *Ch1 = "Note", Ch2; St2 = St1 + a --> Book5 Ch2 = Ch1 + a --> Note5 Thanks ...

Apache, LocationMatch: match query string

How can I match a query string using LocationMatch with apache? <LocationMatch "/index.php?a=b.*"> // ... ... won't work unfortunately. Kind regards ...

String.Split only on first seperator in C# ?

String.Split is convenient for splitting a string with in multiple part on a delimiter. How should I go on splitting a string only on the first delimiter. E.g. I've a String "Time: 10:12:12\r\n" And I'd want an array looking like {"Time","10:12:12\r\n"} ...

Qt tr for internationalisation does not work in main function?

Qt's translation function tr does not work in the main function but works fine in a QWidget member function. Why is that? int main(int argc, char *argv[]) { QApplication a(argc, argv); QDialog dialog; QString temp = tr("dadasda");//error:tr was not declared in this scope dialog.show(); return a.exec(); } ...

Tips on Dealing with Large Strings With Regards to Memory Usage

Hi How can I force a shrink of a DataTable and/or List so that I can free memory efficiently? I am currently removing the processed row from the DataSet every iteration of the loop, but I'm not sure if the memory is being released. for (int i = m_TotalNumberOfLocalRows - 1; i >= 0; i--) { dr = dt.Rows[i]; // Do stuff dt.Rows.R...

argc and argv in main

#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXLINE 1000 int getline(char *s, int lim) { int i = 0; while(i < lim - 1 && (*s = getchar()) != EOF && *s++ != '\n') i++; if(*s == '\n') *s++ = '\n', i++; *s = '\0'; return i; } int main(int argc, char *argv[]) { char line[MA...

Position of character to the left of current position in string

From some arbitrary position in a string I need to find the closest position of a character to the left of my position. If I was wanting to perform this operation to the right I could just use .IndexOf, but how to do it to the left I am unsure. The two ways I came up with were just a decrementing loop starting at my position or, puttin...

string sanitizer for filename

I'm looking for a php function that will sanitize a string and make it ready to use for a filename. Anyone know of a handy one? ( I could write one, but I'm worried that I'll overlook a character! ) Edit: for saving files on a Windows NTFS filesystem. ...

Good way to translate numeric to string, with decimal point removed?

Hi everyone, I have to deal with a numeric value (coming from a SQL Server 2005 numeric column) which I need to convert to a string, with the caveat that the decimal point has to be removed. The data itself is accessible in C# via a DataTable/DataRow. For example, if the SQL Server column reads 12345.678, the string should be "1234567...