Is there a better way for getting rid of accents and making those letters regular apart from using String.replaceAll() method and replacing letters one by one?
Example:
Input: orčpžsíáýd
Output: orcpzsiayd
It doesn't need to include all letters with accents like the Russian alphabet or the Chinese one.
...
Hi, i wonder if it's possible to make a RegEx for the following data pattern:
'152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.'
string = '152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.'
I am using this Regular Expression (Using Python's re module) to extract these names:
re.findall(r'(\d+): (.+), (.+), (.+), (...
I'm trying to convert a wchar_t * to BSTR.
#include <iostream>
#include <atlstr.h>
using namespace std;
int main()
{
wchar_t* pwsz = L"foo";
BSTR bstr(pwsz);
cout << SysStringLen(bstr) << endl;
getchar();
}
This prints 0, which is less than what I'd hoped. What is the correct way to do this conversion?
...
I tried to look at Java's String#intern() method, but it's public native String intern();
In general, how is interning implemented? In String's case?
...
hi all,
I use this code to read data from sqlite database:
keyFromSql = [NSString stringWithCString:(char *)sqlite3_column_text(preparedStatement, 1)];
but the compiler give me the warning wrote in the title... so, what is the right and not deprecated method to retrieve a value from sqlite?
thanks!
...
Hey all,
If I have two char arrays like so:
char one[200];
char two[200];
And I then want to make a third which concatenates these how could I do it?
I have tried:
char three[400];
strcpy(three, one);
strcat(three, two);
But this doesn't seem to work. It does if one and two are setup like this:
char *one = "data";
char *two = "m...
Most programming languages have some support for Unicode, but all have some more or less documented corner cases, where things won't work correctly.
Examples
Java:
reverse() in StringBuilder/StringBuffer work correctly. But length(), charAt(), etc. in String do not if a character needs more than 16bit to encode.
C#:
Didn't find a co...
I am unable to use the fabulous tr() at the moment as I can only use Groovy 1.7.1 and wanted to know if there is an elegant way of going backwards and forwards between string and number encoded with Base32, but with the values A to Z then 2 to 7, rather than 0 to 9 then A to V.
This is to remove customer error in typing in a human reada...
Hello,
Is it possible to call a function by using the strings ?.
i.e i have a variable var target = 'next';. Using this string i want to call the jquery method next() . Should i use target + '()' (this is bit foolish) to call next() ???
I know it can be done using conditional statements. Since it is a var got from users, it is a heav...
Hi,
I was going through some Amazon interview questions on CareerCup.com, and I came across this interesting question which I haven't been able to figure out how to do. I have been thinking on this since 2 days. Either I am taking a way off approach, or its a genuinely hard function to write.
Question is as follows:
Write a function i...
Hello, I'm trying to call a function within a string return statement. Both are in the same class. However, I'm obviously not calling it right because it doesn't work :)
private static function doSomething(){
$d['dt'] = //unix time stamp here;
return '<div class="date" title="Commented on '.date('H:i \o\n d M Y',$d['dt']).'">'.ti...
I have a reasonably large set of strings (say 100) which has a number of subgroups characterised by their similarity. I am trying to find/design an algorithm which would find theses groups reasonably efficiently.
As an example let's say the input list is on the left below, and the output groups are on the right.
Input ...
Hi,
Please forgive me as I am a bit of an sql noob. I am trying to do an insert using the following but am having a problem with the apostrophes. I have a lots of records to insert but many have the same problem.
Is there a way of escaping them?
INSERT INTO [dbo].[tb_Chefs] ([ChefHotelID], [HotelID], [ChefID],
[Position], [Gro...
I'm working on an app that involves a lot of carefully designed strings. I'm in the process of designing the string format and for that I need to know what's possible and what's not when I'm querying the same data.
Which ones of these are possible with MySQL? .. and how do I accomplish them?
Results which contain this exact string -- ...
Hi Guys,
Trying not to repeat myself (to be DRY) here, help me out. =)
I have a double which represents a rating / 5.
The possible values are:
0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5.
I want to convert this to a string without the decimal place.
So the values would become:
"0", "05", "1", "15", "2", "25", "3", "35", "4", "45",...
Suppose I downloaded the HTML code, and I can parse it.
How do I get the "best" description of that website, if that website does not have meta-description tag?
...
If I have a method
def some_method p = {}
string = <<-MY_TERMINATOR
Example text blah blah
lorem ipsum something or another
MY_TERMINATOR
end
how can I access the variable p[:name] from within the heredoc?
...
I'm using eval to simulate arrays. Setting values works fine for integers, but seems to completely fail for strings.
eval("array" add i-1) = arrayVal; // fails for string values
Getting values seems to work perfectly fine either way.
arrayVal = eval("array" add i-1); // works fine for strings and ints
Is there any way around this?...
Hi!
I am struggling with formatting of a db2 query. I would like to replace 2 or more spaces in a string with a semicolon. I know how to do it with all spaces, the question would be how to change only 2 or more spaces :P
Here is an example, i would like to change this:
john doe 1900-01-01 california
to
john doe;1900-01-01;cal...
I have a Java app which needs to interact with the camera on a Windows Mobile device. I have written the Java Code and the Native code and it all works fine. The problem I am having now is that I want to start passing variables from Java to the Native code, e.g. the directory and file name to use for the photo.
The native code uses a ...