string

Generally, are string (or varchar) fields used as join fields?

We have two tables. The first contains a name (varchar) field. The second contains a field that references the name field from the first table. This foreign key in the second table will be repeated for every row associated with that name. Is it generally discouraged to use a varchar/string field as a join between two tables? When is t...

php braces and strings

can anyone explain to me how to use the curly braces { } in php strings? like "this is a {$variable}" "this is a {$user -> getName($variable);} name" ...

VB.NET IsNot for string comparison

If Object.Value IsNot "Something" Then Can you do this, or are there certain cases in which it wouldn't work? Wasn't sure if this should only be used for integers and booleans. Thanks! ...

comparing string literals in c++ templates

I wrote a template function to compare two variables: template <class t> int compare(const t &a, const t &b) { if(a>b) return 1; if (a<b) return -1; return 0; } int main(int argc, const char *argv[]) { cout << compare("hi","world"); return 0; } I get the following error ../src/templates.cpp: In function ‘int main(int...

query string always returns same value - JavaScript

Hey all, I don't expect anyone took read this whole script, but you will notice that there is a sort object with an insert() function that returns an object that use a ternary operator to return either "-order_value" or "order_value", where order_value is a local variable holding a value. Problem is in the query string it always passes ...

MYSQL: Using GROUP BY with string literals

I have the following table with these columns: shortName, fullName, ChangelistCount Is there a way to group them by a string literal within their fullName? The fullname represents file directories, so I would like to display results for certain parent folders instead of the individual files. I tried something along the lines of: GRO...

Android Development: ListPreference Trouble

I don't understand what's going on here. I have a ListPreference with the entries and entryValues correctly set. When I go in the prefernces activity and change the value it successfully works (I added a Toast to output the value after changing the option to test). But when I do the following to compare it, it always executes the else ...

Blackberry - text wrapping to a specific number of lines

I remember asking this question earlier this year as seen in this post. However, that one only wrapped text for up to two lines max. What I want to create is a function that would wrap text up to n number of lines greater than zero (or completely wrap text around the specified width if passing -1 as the argument). In other words, how wo...

Navigating an Array (Android String Array)

Hi. I'm new to android developing but right now I'm working on an application that displays Random Facts. Since I don't want it to be in a random order, I would like to have them in a list. I would like to order through them one by one and show them using TextView. Resources res = getResources(); myString = res.getStringArray(R.array.Fa...

How to make a class that acts like a string?

I have a context manager that captures output to a string for a block of code indented under a with statement. This context manager yields a custom result object which will, when the block has finished executing, contain the captured output. from contextlib import contextmanager @contextmanager def capturing(): "Captures output wit...

Python - About the results retrieved from mysqli

>>> c = conn.cursor() >>> c.execute('select * from stocks order by price') >>> for row in c: ... print row ... (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14) (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0) As what we can see, there's an 'u' in front of each column. And it's getting worse in my db. How could we print the normal string?...

Java toString Method (objects)

class Position { private double x,y; private int id; public String toString(Position a){ String words ="(" + a.x + "," +a.y + ")"; return words; So I'm getting a memory address returned here. What am I doing wrong? I want to get the actual values of x and y that were set using setters. I also have getters...

C#: How do I find the index of an item when only part of the item name is known

Firstly, sorry if the title sounds confusing. How do I find the index of an item in a list string when only a substring of that item is known? Like, I have a list called directories. It has C:\test, C:\new and C:\files (3 items). Using the word "new" only, how can I find the index number of C:\new (that is 1) in directories? I am usi...

Android: Using Hasmap to map a String and int?

Hi, I have a ListView showing names of Countries. I have stored the names in strings.xml as a string-array called country_names. In populating the ListView, I use an ArrayAdapter which reads from strings.xml String[] countryNames = getResources().getStringArray(R.array.country_names); ArrayAdapter<String> countryAdapter = new ArrayAd...

Remove first character from a Javascript string

I have the following string: ,'first string','more','even more' I want to transform this into an Array but obviously this is not valid due to the first coma. How can I remove the first coma from my string and make it a valid Array? Get something like this: myArray = ['first string','more','even more'] Thank you. ...

what is the purpose of using translatable in Android strings?

What is translatable attribute translatable="false" means? ...

Java: how to get Iterator<Character> from String

Hi, I need a Iterator<Character> from a String object. Is there any available function in Java that provides me this or do I have to code my own? ...

python: compare strings with newline

I'm trying to develop a script which compares a runtime generated string against one which is input by the user. Unfortunately, since user inputs his code using a textbox, I get ^M in the string input by user. Example, If I print these strings to file I get this: User Input: 1^M 2^M 3 Output of script: 1 2 3 Obviously, when I try to...

NSURL is nil when using NSDate

Hi guys, I have an NSURL which contains a URL and a variable that is an NSDate: NSURL *url = [[[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://www.googlebio.com/xml_test.aspx?date=%@",self.storeDate]] autorelease]; I also tried it this way but to no avail: NSString*string = [NSString stringWithFormat:@"http://www.go...

Inserting a number as a String into a Text column and SQLite stills removes the leading zero

Hi, I got the following number as a string: String numberString = "079674839"; When I insert this number into a SQLite DB, SQLite automatically removes the leading zero and stores the string as 79674839. Considering affinity and that the column stores TEXT, shouldn't SQLite store the whole string and keep the leading zero? Thanks ...