I want to put space between punctuations and other words in a sentence. But boost::regex_replace() replaces the punctuation with space, and I want to keep a punctuation in the sentence!
for example in this code the output should be "Hello . hi , "
regex e1("[.,]");
std::basic_string<char> str = "Hello.hi,";
std::basic_string<char> fmt = " ";
cout<<regex_replace(str, e1, fmt)<<endl;
Can you help me?
So I have defined variables in such a way in my file:
public static final String hello_world = "hello world"
public static final String awesome_world = "awesome world"
public static final String bye_world= "bye world"
I have many declarations like that.
Is it possible to format them as(All '=' in a line):
public static final String hello_world = "hello world"
public static final String awesome_world = "awesome world"
public static final String bye_world = "bye world"
I can't even think of a way to do it. Any kind of help is appreciated.
P.S If it matters, I use sublime text 2.
I am having a problem in accessing Locale string in android. The requirement is:-
I have one string in english(values/string.xml) as well as in korean(values-ko/string.xml). Now i want to show my string in both languages in a single activity.
I don't want to change phone Locale or call Locale.setDefault("ko")
I am trying to call following line but it is not working for me.
getString(R.string.mystring, Locale.KOREAN); (My default language is English)
Please help
I have two types of strings as the IDs of elements in my HTML markup:
Dates:
"april-23"
"march-20"
and season names:
"springtime"
"winter"
The dates have a dash separating the month and the day.
The seasons are a single word with no other tokens.
I want to assign the month or the season to a new variable called:
time_of_year
If I do this:
var time_of_year = $(this).attr("id").split('-')[0];
It will work on the months but if I call it on a season name which does not contain the token, will it generate an error?
What's the safe way to do this?
Hi! I was trying to split an arithmetic expression (eg "1+2+10+15") on the plus signs. However, I didn't manage to write the appropriate regular expression. I thought this would work:
expression.split("\\+");
but it doesn't. Do you know the correct solution?
Hi folks,
In Oracle 10g, is there a way to do the following in PL/SQL?
for each table in database
for each row in table
for each column in row
if column is of type 'varchar2'
column = trim(column)
Thanks!
Hello world,
EDIT: I would like to avoid doing something like this:
var str = 'Hello';
if ( str == 'Hello') {
alert(str);
}
I would rather do:
var str = 'Hello';
$(str).filter(':contains("Hello")').each(function(){
alert(this)
});
I've tried a lot of things:
$(str).text().method1().method2().method3();
$(str).val().method1().method2().method3();
$(str).contents().method1().method2().method3();
Nothing worked. Is it possible to do this?
Thank you for your time.
Kind regards,
Marius
I was given an interview question:
// The first example:
char text[] = "henri";
char *p;
p = text;
*(p + 1) = 'E'; // Output = hEnri
// Now If we want to remove the "e" ie hnri, we would go for?????
*(p + 1)=?????
The obvious answer is to copy the rest of the array "back" one position. But this seems... unpleasant. Surely there is some better way?
I tried this
SELECT convert(datetime, '23/07/2009', 111)
but got this error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
However
SELECT convert(datetime, '07/23/2009', 111)
is OK though
How to fix the 1st one ?
Thanks
Hello,
I have the following struct in C# class
public struct Employee
{
public const string EMPID = "EMP_ID";
public const string FName = "FIRST_NAME";
public const string LNAME = "LAST_NAME";
public const string DEPTID = "DEPT_ID";
}
Is there an easy way to build a string as follows
const string mainquery="INSERT INTO EMP(EMP_ID,FIRST_NAME,LAST_NAME,DEPT_ID) VALUES(:EMP_ID,:FIRST_NAME,:LAST_NAME,:DEPT_ID)"
Instead of doing as follows
and then concatenating it.
const string EMP_COLS=
EMPLOYEE.EMPID + "," +
EMPLOYEE.FNAME + "," +
EMPLOYEE.LNAME + "," +
EMPLOYEE.DEPTID;
const string EMP_Values=
EMPLOYEE.EMPID + ":" +
EMPLOYEE.FNAME + ":" +
EMPLOYEE.LNAME + ":" +
EMPLOYEE.DEPTID;
To be specified:
function getLength($str)
{
//function i need
}
$str1 = 'aabbcccc';
$str2 = 'aabbccccaaaaa';
echo getLength($str1); //will get 4
echo getLength($str2); //will get 5
Any good ideas?Thanks in advance!
For example, a user entered "I love this post!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
the consecutive duplicate exclamation mark "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" should be detected.
Hello
I have some data in the format of
C222 = 50
C1234P687 = 'some text'
C123YYY = 'text'
C444 = 89
C345 = 3
C122P687 = 'some text'
C122YYY = 'text'
....
....
so basically 3 different forms
"C" number = value, example - C444 = 89
"C" number "P" number = value, example - C123P687 = 'some text'
"C" number "YYY" = value
Only number is of variable length on the left side of (=) sign. Values vary.
I want to store the data in db as
INSERT INTO datatable
c_id = "number after C"
p_id = "number after P" // if it exists for a line of data
value = 'value'
yyy = 'value'
Any ideas how to retrieve these numbers?
Thanks
This code is compiling clean. But when I run this, it gives exception "Access violation writing location" at line 9.
void reverse(char *word)
{
int len = strlen(word);
len = len-1;
char * temp= word;
int i =0;
while (len >=0)
{
word[i] = temp[len-1]; //line9
++i;--len;
}
word[i] = '\0';
}
For example, a user entered "I love this post!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
the consecutive duplicate exclamation mark "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" should be detected.
The latest version of the Scribes text editor lets us select some text, hit Alt+X, and then run an arbitrary command. For example, I can run the sort command and the selected text is replaced appropriately.
This is quite useful but I am also not very well-versed in awk and the like. Is there something I can grab that will provide more of these commands like sort? Maybe a package with a whole bunch of handy, task-specific string manipulation commands?
I'm totally new to JSON, and have a json-string I need to display as a user-friendly table.
I have this file, http://ish.tek.no/json_top_content.php?project_id=11&period=week, witch is showing ID-numbers for products (title) and the number of views.
The Title-ID should be connected to this file; http://api.prisguide.no/export/product.php?id=158200 so I can get a table like this:
ID | Product Name | Views
158200 | Samsung Galaxy SIII | 21049
How can I do this?
Since the last weeks we see many 404's on our sites caused by Chrome adding /cache/[hex-string]/ to the current page URL.
The hex strings we have seen are:
e9c5ecc3f9d7fa1291240700c8da0728
1d292296547f895c613a210468b705b7
408cfdf76534ee8f14657ac884946ef2
9b0771373b319ba4f132b9447c7060a4
b8cd4270356f296f1c5627aa88d43349
If you search for these strings you get matches from different sites, but they are most likely auto-generated (/search/cache/e9c5ecc3f9d7fa1291240700c8da0728/ for example).
Is this a known issue with Chrome (or an extension)?
Many times we want to split a string into an array and get a list of each word separately. The sys.dm_fts_parser function will help us in these cases. More over, this function will also differentiate the noise words and exact match words. The sys.dm_fts_parser can be also very powerful for debugging purposes. It can help you check how the word breaker and stemmer works for a given input for Full Text Search.
An optimized Damerau-Levenshtein Distance (DLD) algorithm for "fuzzy" string matching in Transact-SQL 2000-2008
Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.
When you are first learning PowerShell, it often seems to be an 'Alice through the looking-glass' world. Just the simple process of comparing and selecting strings can seem strangely obtuse. Michael turns the looking-glass into wonderland with his wall-chart of the PowerShell string-comparison operators and syntax
The Future of SQL Server MonitoringMonitor wherever, whenever with Red Gate's SQL Monitor. See it live in action now.