string

String Format expression to show Currency with 2 decimal places only if there are decimals (.net)

Silverlight 4/C#: I have a label showing a number formatted in the Currency (with 2 decimal places) of the thread culture, e.g. 25 shows as $25.00 and 25.01 shows as $25.01 I use "StringFormat=C2" for this. My problem is... I only want to show the 2 decimal places IF there are decimal places. e.g. 25 should show as $25 and 25.01 shou...

PHP regex for matching double and/or single quoted strings within in a string.

Hello, I'm working on a template class and I've an issue when trying to parse out a list of quoted strings from a string argument list. Take for example the string: $string = 'VAR_SELECTED, \'Hello m\'lady\', "null"'; I'm having a problem coming up with a regex that extracts the string "Hello m'lady" and "null". The closest I have go...

Using scanf with NSStrings

I want the user to input a string and then assign the input to an NSString. Right now my code looks like this: NSString *word; scanf("%s", &word); ...

Modify a single XML attribute in C#

I've got it writing the XML doc fine, and it will look something like this <Team> <Character Name="Bob" Class="Mage"/> <Character Name="Mike" Class="Knight"/> </Team> I'm trying to find a way to access "Class" attribute of a single character and modify it. So far, i've got it to the point where I can pinpoint a specific character,...

Declare HTML tag as a string in VB.NET

Hi, I'm trying to assign the following HTML as a value to variable type string 'here's the tag '$("#close").click(function(){$.notifyBar({ html: "Click 'close' to hide notify bar", close: true, delay: 1000000 });}); Dim htmltag = "$("#close").click(function(){$.notifyBar({ html: "Click 'close' to hide notify bar", clos...

How can I find the first occurrence of a sub-string in a python string?

So if my string is "the dude is a cool dude". I'd like to find the first index of 'dude': mystring.findfirstindex('dude') # should return 4 What is the python command for this? Thanks. ...

Converting non-english latin characters to english equivilents

Hi, I need to compare the names of European places that are written using the extended latin alphabet - there are lots of central and eastern european names that are written with characters like 'ž' and 'ü', but some people write the names just using the regular english-latin alphabet. I need a way to have my system recognise 'mšk žili...

How do I create a string from a block of text that contains the " character

I've got a block of html code that includes some form action stuff, which has the " appearing a lot. Is there a way I can make the entire block into a string? public string methodName() { return @ " text goes here.. blah blah <p> a bit of html stuff</p> <form action="www...." method="post"> <input type="hidden" name="cmd" I g...

C++: insert char to a string

Hello, so I am trying to insert the character, which i got from a string, to another string. Here I my actions: 1. I want to use simple: someString.insert(somePosition, myChar); 2. I got an error, because insert requires(in my case) char* or string 3. I am converting char to char* via stringstream: stringstream conversion; char* myC...

Wicket resource - string not found?

I'm playing with wicket's form input components. I tried to put an enum to a DropDownMenu: public enum Choice { ONE, TWO, THREE } cz.oz.wicket.pages.form.FormPage.java -------------- .add( new DropDownChoice("choice", Arrays.asList( Choice.values() ), new EnumChoiceRenderer() ) ) and added a properties file: cz.oz.wi...

Is the char literal '\"' the same as '"' ?(backslash-doublequote vs only-doublequote)

Is there's any difference between char literals '\"' and '"' ? ...

Removing HTML tags from a unicode string in Python

Hey all, I have a strong that I scraped from an XML file and It contains some HTML formatting tags (<b>, <i>, etc) Is there a quick and easy way to remove all of these tags from the text? I tried str = str.replace("<b>","") and applied it several times to other tags, but that doesn't work ...

Regular Expression vs KMP

Hi can any one tell me why there we are not using Knuth Morris Pratt algorithms in modern programming practices and prefer regular expression more ? ...

how to create a "nested split" of sorts

This seems like it should be fairly simple, but for some reason I can't think of the right way to do this: I have a string h that looks something like one(two(three four) five six) seven. I'd like to split this up into an array of hashes so that the output is something like {'one' => {'two' => {'three' => nil, '...

Return array of strings

I've been trying to get this to work for a good few hours now, but I can't seem to get my head around it. I'm trying to write a function that is able to return an array of strings. #include <stdio.h> #include <stdlib.h> /** * This is just a test, error checking ommited */ int FillArray( char *** Data ); int main() { char ** Da...

How to write the data to the plist

HI can u send me sample code to add the data to the .plist. .my plist was in this format as follows.kindly help me out <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; <plist version="1.0"> <array> <string>http://localhost:8888/sample&lt;/s...

PHP String returns with HTML

I want to return HTML string as follows from my controller. $returnValue = "<a onclick='demosuccess(". chunk_split( base64_encode( $details['clientid'] ) ). ",".chunk_split( base64_encode( $details['email'] ) ). ",1)' >$this->lang->line('link_sendactivation')</a>"; But,it getting error.I tried it by different combinations...

Ellipsize only a section in a TextView

Hi! I was wondering if it is possible to abbreviate only a portion of a string in a TextView. What I would like to do is something like this: Element with short title (X) Element with a very lo...(X) The title should be ellipsized, but the X must be always visible. In my case, is not possible to use more than one TextView. Do you thi...

Concatenating a second string to a row already containing a string

I have a PHP process running as a result of a JavaScript AJAX request, which is potentially running for some time and will produce data from time to time. From a usability perspective, I'd like to be able to return data to the JavaScript as soon as it's produced, but this appears not to be possible. My workaround is to write it to an SQ...

Print elements of a list to a .csv file

I am reading in a csv file and dealing with each line as a list. At the end, I'd like to reprint to a .csv file, but the lines aren't necessarily even. I obviously cannot just go "print row", since this will print it as a list. How can I print it in .csv format? ...