i have a string of the format SUCCESS,12:34:56:78:90, i want to separate these two values that are separated by commas into two different strings. how do i do that in gcc using c language.
Hi all!
I Use this code:
NSString* strName = [NSString stringWithFormat:@"img_00%d.jpg", pp];
and works fine, but if pp took the value of 10 for example I wish have img_010.jpg as result, and not img_0010.jpg...
how can I format the string??
thanks
What query is suitable to compare two tables specied below, however only part of string in location(table1) will matches with the Location(table2).
Location(table1) Location(table2)
india- north USxcs
India-west Indiaasd
India- east Indiaavvds
India- south Africassdcasv
US- north Africavasvdsa
us-west UKsacvavsdv
uk- east Indiacascsa
uk- south UScssca
Africa-middle Indiacsasca
Africa-south Africaccc
Africa-east UKcac
only 1st two characters of location(table1) and 1st two characters of location(table2) should match. Please help
only any four characters of location(table1)and any two characters of location(table2)should match.
I'm building a calculator application, and I have a Form, with a TextBox called txtVisor, that has the property NumbersOnly = true. I want to get the content of it(that I already know: txtVisor.Text) and convert it into a Integer, to do multiply it by 12, then convert the result into a String to set the txtVisor.Text as the result of the operation. How could I do this?
PS: I'm using NSBasic 7.0
Hello.
This may sound easy, but I've been trying - in vain, apparently - to figure out how I can make a query with MySQL that checks if the value (string $haystack ;) ) in a certain column contains certain data ( $needle ;) ), like this:
mysql_query("
SELECT *
FROM `table`
WHERE `column`.contains('{$needle}')
");
In PHP, the function is called substr($haystack, $needle), so maybe:
WHERE substr(`column`, '{$needle}')=1
Thanks in advance!
I get a string from a db, then I remove all the HTML tags, carriage returns and newlines, before I put it in a csv. Only thing is I cant remove the excess white space from between the strings, any ideas?
Thanks,
Joe
I'd like to be able to parse out the city, state or zip from a string in python. So, if I entered
Boulder, Co
80303
Boulder, Colorado
Boulder, Co 80303
...
any variation of these it would return the city, state or zip.
This is all going to be user inputted data and inputted in one text field.
I have a string that looks like this:
CALDARI_STARSHIP_ENGINEERING
and I need to edit it to look like
Caldari Starship Engineering
Unfortunately it's three in the morning and I cannot for the life of me figure this out. I've always had trouble with replacing stuff in strings so any help would be awesome and would help me understand how to do this in the future.
I'm trying to remove all BBCode Tags from a string.
[url]www.google.com[/url]
becomes
www.google.com
I have a regex that works in php to find them all, just dont know how to remove them in .net
RegEx to Find BBCode
|[[\/\!]*?[^\[\]]*?]|si
Right now i'm trying to get this:
Array
(
[0] => hello
[1] =>
[2] => goodbye
)
Where index 1 is the empty string.
$toBeSplit= 'hello,,goodbye';
$textSplitted = preg_split('/[,]+/', $toBeSplit, -1);
$textSplitted looks like this:
Array
(
[0] => hello
[1] => goodbye
)
I'm using PHP 5.3.2
I would like to insert a line break into the first space between words in a string variable. Here is my code so far:
<cfset myPosition = find(" ", #myVar#)>
<cfset lineBreak = Chr(13)&Chr(10)>
<cfset myVar = insert(#lineBreak#, #myVar#, #myPosition#)>
What am I doing wrong?
How do i convert a byte[] to a string, every time i attempt it i get System.Byte[] instead of the value.
Also How do i get the value in Hex instead of a decimal?
I'm trying to select an id that changes on different posts of same page. So the they have been given an id="show_posts_{PostID}" - on the final output the {PostID} is replaced with a number. In the function I need to call $('show_posts_XXXXXX') - XXXXXX being the generated ID. I have stored this ID in a variable called postId.
But I can't seem to do this $("'" + "show_posts_" + postId + "'")
Can anyone tell me how I can add a string to the end of a selector?
I am using following directives in my htaccess to remove trailing slashs from my uris to prevent duplicate content. However these directives also remove any query string, that might be present.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain\com$ [NC]
RewriteRule ^(.+)/$ http://www.mydomain.com/$1 [R=301,L]
I'd like to know how to remove a potential trailing slash from my URI, but also preserve query strings.
What is the best or most concise method for returning a string repeated an arbitrary amount of times?
The following is my best shot so far:
function repeat(s, n){
var a = [];
while(a.length < n){
a.push(s);
}
return a.join('');
}
hi everyone,
i have an object called Student, and it has studentName, studentId, studentAddress, etc.
for the studentId, i have to generate random string consist of seven numeric charaters,
eg. studentId = getRandomId();
studentId = "1234567" <-- from the random generator.
and i have to make sure that there is no duplicate id.
thanks in advance
I want to extract key value pairs of some form elements in a html page
for example
name="frmLogin" method="POST" onSubmit="javascript:return validateAndSubmit();" action="TG_cim_logon.asp?SID=^YcMunDFDQUoWV32WPUMqPxeSxD4L_slp_rhc_rNvW7Fagp7FgH3l0uJR/3_slp_rhc_dYyJ_slp_rhc_vsPW0kJl&RegType=Lite_Home"
is there any method using which I can safely get the key and value pairs. I tried using splitting by spaces and then using '=' characters but string inside quotes can also have '='.
is there any different kind of split method which can also take care of quotes?
So i'd like to do this:
switch (keyPath) {
case @"refreshCount":
//do stuff
case @"timesLaunched":
//do other stuff
}
but apparently you can only use integers as the switch quantity. Is the only way to do this parse the string into an integer identifier and then run the switch statement?
like this:
nsinteger num = nil;
if (keyPath isEqual:@"refreshCount") {
num = 0
}
if (keyPath isEqual:@"timesLaunched") {
num = 1
}
I'm trying to optimize this code to be as quick as possible because its going to get called quite often.
thanks,
Nick
Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like:
#remove all chars up to first occurrence of cat or dog or rat
$pattern = 'cat|dog|rat'
$pagetext =~ s/(.*)($pattern)/$2/xms;
What's the best way to do it in Python?
strdate=15/06/2010
DateTime dt = DateTime.Parse(strdate, System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat);
i cannot able to get the datetime value as dd/mm/yyyy.
it is giving exception 'string is not recognized as a valid datetime'
oly if it is in 06/15/2010 it is working. how to get the same format in dt.
Hi,
i have a question, what is the best way to append ints and Strings to build a new String? In the allocation debug tool i see too much allocations if i use the operator +.
But i have tried also with StringBuffer and there are still too much allocations.
Anyone can help me?
Thanks