I am using an XMLParser to parse some XML data, which uses an NSMutableString *resultString to store the tag characters. At every (- parser: didStarElement...) method I allocate and init the resultString-ivar.
- (void)parser: (NSXMLParser *)parser didStartElement: (NSString *)elementName namespaceURI: (NSString *)namespaceURI qualified...
How to remove the last character only if it's a period?
$string = "something here.";
$output = 'something here';
...
I need to format a float (catchy title, he?) to 2 decimal places, but only if those decimal places have values that aren't zero. Example:
I have a NSTextField named 'answer', after I do some math with a couple of floats, I want to assign my 'answerFloat' variable to the 'answer' NSTextField. So far I've got:
[answer setStringValue:[NSS...
I extracted the following node from XmlReader:
string xml = "<FeatureType xmlns=\"http://www.opengis.net/wfs\" > </FeatureType>"
In order to deserialize to a predefined class, I attempted:
using (StringReader elementReader = new StringReader("<?xml version='1.0'?>" + xml ))
{
// TODO: Can data contract serializer be used?
Xml...
I'm a Python beginner, and I have a utf-8 problem.
I have a utf-8 string and I would like to replace all german umlauts with ASCII replacements (in German, u-umlaut 'ü' may be rewritten as 'ue').
u-umlaut has unicode code point 252, so I tried this:
>>> str = unichr(252) + 'ber'
>>> print repr(str)
u'\xfcber'
>>> print repr(str).repl...
Hi,
Whenever I try to add the numbers in string like:
String s=new String();
for(int j=0;j<=1000000;j++)
s+=String.valueOf(j);
My program is adding the numbers, but very slowly. But When I altered my program and made it like:
StringBuffer sb=new StringBuffer();
for(int j=0;j<=1000000;j++)
sb.append(String.valueOf(j));
I ...
I see that Visual Studio 2008 and later now start off a new solution with the Character Set set to Unicode. My old C++ code deals with only English ASCII text and is full of:
Literal strings like "Hello World"
char type
char * pointers to allocated C strings
STL string type
Conversions from STL string to C string and vice versa using S...
I am looking for a way to replace keywords within a html string with a variable. At the moment i am using the following example.
returnString = Replace(message, "[CustomerName]", customerName, CompareMethod.Text)
The above will work fine if the html block is spread fully across the keyword.
eg.
<b>[CustomerName]</b>
However if the...
Strings are usually enumerated by character. But, particuarly when working with Unicode and non-English languages, sometimes I need to enumerate a string by grapheme. That is, combining marks and diacritics should be kept with the base character they modify. What is the best way to do this in .Net?
Use case: Count the distinct phonetic ...
Hello,
I am tring to convert a set of strings to a byte[] array. At first, I do something like this to convert a byte array to a string:
public String convertByte(byte[] msg) {
String str = "";
for(int i = 0; i < msg.length; i++) {
str += (msg[i] + " * ");
}
return str;
}
When I try to convert b...
There are a number of Win32 functions that take the address of a buffer, such as TCHAR[256], and write some data to that buffer. It may be less than the size of the buffer or it may be the entire buffer.
Often you'll call this in a loop, for example to read data off a stream or pipe. In the end I would like to efficiently return a strin...
I have a service bus, and the only way to transform data is via JavaScript. I need to convert a Guid to a byte array so I can then convert it to Ascii85 and shrink it into a 20 character string for the receiving customer endpoint.
Any thoughts would be appreciated.
...
Hi,
I have html stored in a string variable within my c# .net 2.0 code. Below is an example:
<div class="track">
<img alt="" src="http://hits.guardian.co.uk/b/ss/guardiangu-feeds/1/H.20.3/30561?ns=guardian&pageName=Hundreds+feared+dead+in+Haiti+quake%3AArticle%3A1336252&ch=World+news&c3=GU.co.uk&c4=Haiti+%28News%29%...
Let's say I have this string:
"birthday cake is my favorite"
I need to convert that to:
"birthday|cake|is|my|favorite"
How would I go about doing that with Ruby?
...
Hi,
Hoping someone can assist with some string manipulation using jQuery.
Basically, within a .click(function(){ I have the following string variable:
f?p=251:1007:3642668879504810:::::
What I need to do using jQuery is basically remove the number 3642668879504810 (which changes, i.e is a random number so cannot match on this number...
I have large strings that resemble the following...
some_text_token
24.325973 -20.638823
-1.964366 0.753947
-1.290811 -3.547422
0.813014 -3.547227
0.472015 3.723311
-0.719116 3.676793
other_text_token
24.325973 20.638823
-1.964366 0.753947
-1.290811 -3.547422
-1.996611 -2.877422
0.813014 -3.547227
1.63236...
Having my own Java code I'm using C# to call some unmanaged code that call (via JNI) the java code. I'm using JNI since I need to ensure:
the ability that the Java code will run over real JVM and not over some .NET VM
the ability to attach to the VM for debugging (IKVM does'nt support it)
I need free solution
The current free solutions...
Hi All, what we can do to remove page=2&
From:
"page=2¶m1=value1¶m2=value2" or
"param1=value1&page=2¶m2=value2".
become:
"param1=value1¶m2=value2" or
"param1=value1¶m2=value2".
in case of page=2, 2 is any natural no. i.e. (0 to 32000).
Regards,
...
I would like to brake a long word in my Ruby on Rails string (something like <wbr> in HTML). Is it possible to tell Ruby "add character x in string y each z characters"?
...
Hello, could anyone tell me or point me to a simple example of how to append an int to a stringstream containing the word "Something" (or any word)?
Thanks!
...