Hi.
On one of my models I have a property annotated with:
[StringLength(60, ErrorMessage="Title must be between 60 and 10 characters", MinimumLength=10)]
When the form posts to the server, if it's under 10 characters, then validation fails as it should do. However, on the client-side, it only checks that it's under 60 characters -- n...
Ok, here goes a newbie question:
//function removes characters and spaces that are not numeric.
// time = "2010/09/20 16:37:32.37"
function unformatTime(time)
{
var temp = "xxxxxxxxxxxxxxxx";
temp[0] = time[0];
temp[1] = time[1];
temp[2] = time[2];
temp[3] = time[3];
temp[4] = time[5];
temp[5] = ...
I'm curious what the proper way to trim a string is to ensure that no memory leak occurs. I guess this may really be a question based on exactly how free() works. I've included the code for my trim() function. See below.
int main()
{
char* testStr1 = strdup("some string");
char* testStr2 = strdup(" some string");
char* ...
I want to be clear about all the advantages/disadvantages of the following code:
{
char *str1 = strdup("some string");
char *str2 = "some string";
free(str1);
}
str1:
You can modify the contents of the string
str2:
You don't have to use free()
Faster
Any other differences?
...
I have a string of varying length and is usually followed by white spaces (of varying length based on he string).
i.e. - the string is always 20 characters long
var data = "DUR IT R4356 " //with 8 trailing
or the string could be
var data = "11& 444 DTF# 5676 " //with 3 trailing
What is the best way to get rid of those tra...
I want to remove a string that is between two characters and also the characters itself , lets say for example:
i want to replace all the occurrence of the string between "#?" and ";" and remove it with the characters.
From this
"this #?anystring; is #?anystring2jk; test"
To This
"this is test"
how could i do it in java ? ...
Is this a ligitimate way of determining the selected value of an section/option box with and id of "shirt_size_1221"?
var user_id = '1221';
x = "#shirt_size_" + user_id ;
alert($(x + " option:selected"));
...
Hi,
I want to know if there is a way to use something like this:
$t1=1;
$t2=2;
$t3="$t1>$t2";
if($t3)
echo "Greater";
else
echo "Smaller";
This will evaluate to true as $t3 is a string, but that's wrong!!!
So is there a way to include the if condition inside string.
I heard that we can use eval for this:
http://stackoverflow....
Hello!
I'm trying to figure out function that will help me wrap first word in string into span.
But unfortunately no luck.
Can anyone help me please?
Many Thanks
Dom
...
How to split the string "Thequickbrownfoxjumps" to substrings of equal size in Java.
Eg. "Thequickbrownfoxjumps" of 4 equal size should give the output.
["Theq","uick","brow","nfox","jump","s"]
Similar Question:
Split string into equal-length substrings in Scala
...
hi guys, i'd like to know if there a way to get atof continue converting to number even if there are non valid charcters in the way
for example let say i have string "444-3-3-33"
i want to covert it to a double a=4443333
(and keep the string as it was)
happy to get any suggestions or an alternative way
thanks!
...
I try to compare strings in PostgreSQL.
Here are queries that I execute:
select 'UK (z'>'Ukraine';
This one returns true;
Then I try following one:
select 'UK ('>'Ukraine';
This one returns false;
I think, that both of these should return false , and on another PostgreSQL server it behaves correctly. But main server is producing...
$string = "
put returns between paragraphs
for linebreak add 2 spaces at end
";
Want to remove all new lines from string.
I've this regex, it can catch all of them, the problem is I don't know with which function should I use it.
/\r\n|\r|\n/
$string should become:
$string = "put returns between paragraphs for linebreak add 2 sp...
Hi
I have a array that looks like this:
$sites = array('Twitter' => 'http://twitter.com/home?status=$status',
'Digg' => 'http://digg.com/submit?phase=2&title=$title',
....
);
$status = 'bla bla';
$title = 'asdasf';
foreach($sites as $site_name=>$site_url)
echo '<li...
How do I remove extra spaces at the end of a string using regex (preg_replace)?
$string = "some random text with extra spaces at the end ";
...
Hi
so the string is like this:
"bla bla bla {VARIABLE} bla bla"
when I use this string somewhere in a function I want to replace {VARIABLE} with $variable (or any other uppercase strings with wrapped within {} charcters). $variable (and any other variables) will be defined inside that function
Can i do this?
...
I'm trying to compare 2 strings by "==" operator.
when i print the string both are identical.
but length of one is bigger by one, i figured it is the null terminator.
any way to ignore this when comparing??
Thanks!!
City* Adjutancy::FromStringToCity(string cityName) const
{
for (list<City*>::const_iterator it=m_citiesList.begin();it...
Could someone please explain to me how to draw a
string using UIStringDrawing instead of using a label? here is my code but for some reason it compiles and the screen is blank...
//
// MainViewController.m
// DotH
//
#define WINDOW_FRAME [[UIScreen mainScreen] bounds]
#define SCREEN_FRAME [UIScreen mainScreen].applicationFrame
#defin...
In PHP, what is the simplest way to return the portion of a string before the first occurrence of a specific character?
For example, if I have a string...
"The quick brown foxed jumped over the etc etc."
...and I am filtering for a space character (" "), the function would return
"The"
Thanks!
...
Im sure I have seen an implementation of this in PHP somewhere and I am positive if it exists its a PHP 5 thing. Any way I was wondering if it was possible to set and run a function from a string and set the returned value to the value of the string. e.g.
<?php $hi = function(){ return "Hello World"; };
echo $hi(); ?>
It probably is ...