string

How to get subset of string using Javascript/JQuery/JSON?

Hi, I want to get a subset of a string in Javascript. Currently, I only know how to store the entire string: I have this as a JSON variable with a callback to foo: foo({"results":[ "<div id=\"following\"><span><a href=\"http://twitter.com/barackobama\"&gt;Obama&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;" ]}) And this is my callback function:...

getc and getwc: How exactly do they read stdin?

Hello. I'm not exactly sure whether or not this is a silly question, but I guess I will find out soon enough. I'm having problems understanding exactly how getc and getwc work. It's not that I can't use them, but more like I don't know exactly what they do. int and getc return most characters if I `printf("%c") them, including multibyte...

how to remove empty space

In j2me ,i have editfield which takes its input ,in it we can enter 3 digits when i enter first and third ,leaving 2nd digit empty , how to remove empty digit thanks ...

Store a reference to a string

I have a class that has 3 string properties. I want to store these in a list so that when I make changes to the strings of the list they also get updated in the class. This would be easy to do if I was using class object, but string seems to behave differently. It seems to make a copy of the object for the list rather then have a poin...

What happens at compile and runtime when concatenating an empty string in Java?

This is a question that arose mostly of pure curiosity (and killing some time). I'm asking specifically about Java for the sake of concreteness. What happens, in memory, if I concatenate a string (any string) with an empty string, e.g.: String s = "any old string"; s += ""; I know that afterward, the contents of s will still be "any ...

toLowerCase with special/unicode characters throws exception

correct me if I'm wrong. If str has a character such as "•" in it then running: str.toLowerCase(Locale.English); throws a null pointer exception. That's the behavior I'm seeing. So what's the deal here? What's going on? It isn't specified that toLowerCase throws a null pointer exception. Is there an easy way to get around this? I n...

What's a good way to replace international characters with their base Latin counterparts using Python?

Hi there. Say I have the string "blöt träbåt" which has a few a and o with umlaut and ring above. I want it to become "blot trabat" as simply as possibly. I've done some digging and found the following method: import unicodedata unicode_string = unicodedata.normalize('NFKD', unicode(string)) This will give me the string in unicode for...

Drawing a contrasted string on an image

Hey, So, I have a snapshot of a video source, which I get into an Image, grab a Graphics object for it, and then draw a timestamp in the bottom right of the image. No problem thus far. However, I cannot guarantee what colour is going to be behind the text, so no matter what brush I use, it will almost certainly clash with some of the ...

Really simple short string compression

Does anyone know of a really simple compression technique for strings up to about 255 characters in length (yes I'm compressing urls)? Not concerned with strength of compression - I am looking for something that performs very well and is quick to implement. I would like something simpler than SharpZipLib: something that can be impleme...

In .Net, "most terse" way to check if string is one of multiple values?

I want to check whether a string matches one of a list of values. There are of course many, many ways I could go about this: if statement, switch statement, RegEx, etc. However, I would have thought that .Net would have something along the lines of if (myString.InList("this", "that", "the other thing")) So far the closest thing I can...

Check if a string contain Asterisk (*)

I want to check if my string contain one or more asterisk. I have tried this : if [[ $date_alarm =~ .*\*.* ]] then ... fi It worked when I launch directly the script, but not if this script is called during shutdown (script installed in run level 0 and 6 via update-rc.d) Any idea, suggestion ? Thanks ...

Delphi: Strings in Records bigger than 255 chars.

Is there a way to get strings in records bigger than 255 chars? EDIT: I have something like the following: TQuery = Record Action: string[255]; Data: string; end; if I now say: Test: TQuery; Test.Data := 'ABCDEFGHIJKLMN...up to 255...AISDJIOAS'; //Shall be 255 chars It does not work and the compiler complains... How to fix th...

obtaining text from a QListView

Hey, I have a pointer to a third party QListView object, wich is simply displaying rows of text. What is the best way of getting a hold of that string of text? thanks, Dave ...

What is the difference between String and nvarchar(5000) in SQL?

I am doing my first database project in PostgreSQL or Oracle. I would like to get an answer for my question. ...

Cleanest way to parse this pattern of strings?

I have music file names like: Gorillaz (2001) Gorillaz (7th State Mix) (2002) Gorillaz (2001) (Featuring Travis) Gorillaz (1Mix) (2003) Gorillaz (1000) (2001) How do I parse the year in the cleanest, easiest way? Right now I am parsing them by finding each '(' and then making sure the character count between the ()s are 4 and first c...

Finding bad string in C

I am pulling information from a binary file in C and one of my strings is coming out as \\b\\3777\\375\\v\\177 in GDB. I want to be able to parse this sort of useless data out of my output in a non-specific way - I.e anything that doesn't start with a number/character should be kicked out. How can this be achieved? The data is being buf...

smart way to shorten long strings with javascript

Does anyone have a more sophisticated solution/library for shortening strings with JavaScript, than the obvious one: if(string.length > 25) { string = string.substring(0,24)+"..."; } ...

What is an efficient way to parse a String in Java?

How should I parse the following String using Java to extract the file path? ? stands for any number of random charaters _ stands for any number of white spaces (no new line) ?[LoadFile]_file_=_"foo/bar/baz.xml"? Example: 10:52:21.212 [LoadFile] file = "foo/bar/baz.xml" should extract foo/bar/baz.xml ...

Java: Is assertEquals(String, String) reliable?

I know that == has some issues when comparing two Strings. It seems that String.equals() is a better approach. Well, I'm doing JUnit testing and my inclination is to use assertEquals(str1, str2). Is this a reliable way to assert two Strings contain the same content? I would use assertTrue(str1.equals(str2)), but then you don't get th...

Using instr when string is nothing

Hi, I have the following condition If InStr("a,b,c", stringA) > 0 OrElse (InStr("y,z", stringB) > 0 AndAlso value = 0) Then endif COndition 1 is false so i check for condition 2 that is "(InStr("y,z", stringB) > 0 AndAlso value = 0) " What puzzles me is that when stringB is nothing it still falls into the if condition and executes the...