string

Java multiline string

Coming from Perl, I sure am missing the "here-document" means of creating a multi-line string in source code: $string = <<"EOF" # create a three line string text text text EOF In Java I have to have cumbersome quotes and plus signs on every line as I concatenate my multiline string from scratch. What are some better alternatives? D...

Replace umlaute (äüö) for SEO link in rails - best way

Hi, I'm using the permalink_fu plugin to create permalinks from titles. My problem is: If the title contains german characters, they are just replaced with '_'. What I need is something that replaces ä with ae ü with ue ö with oe I fount String.tr but the problem here is that it replaces 1 character with 1 replacement, so it would wor...

Getting the longest string (ending by a newline) out of a Textarea in Flex

Hi, This somehow simple task is not so simple. I can get the number of lines of the textarea using mx:internals, but thats is not always the longest line ending by a newline. I tried all sort of textArea.text.split("\n") \r <br/> {/n .. It always returns me the length of 1. My eternal worshipping to anyone who can put me in the righ...

Separate String with separator #@#

Hi All, The string below I have to call three times using sql. String: JAN#@#PIET#@#HENK The first call shoudl return: JAN The second call: PIET The third: HENK So we could use the #@# as separator but it could be that the string is: JAN#@#PIET only. Still all three calls will be done where call 1 returns: JAN call 4 returns: PIET c...

SQL Separate String

Duplicate Separate String with separator #@# The string below I have to call three times using sql. String: JAN#@#PIET#@#HENK The first call shoudl return: JAN The second call: PIET The third: HENK So we could use the #@# as separator but it could be that the string is: JAN#@#PIET only. Still all three calls will be done wher...

The History Behind the Definition of a 'String'...

I've never thought about until just now, but I'm not sure why we call 'strings', strings. I'm a .Net programmer, but I know the concept of strings exist in virtually every language. Outside of programming, I don't think I've heard the word 'string' used to describe words or letters. A quick Google of, 'Define: string' yields a bunch o...

Count the number of occurances of a character in a string in Javascript

Hi, Firstly, I am new to Javascript. I need to count the number occurances of a character in a string. Its something like suppose my string contains var mainStr = "str1,str2,str3,str4"; My return value should be 3 I also need to validate that each of the strs i.e str1 or str2 or str3 or str4 should not exceed say 15 character. Ca...

Using a string as a variable at run time in ruby on rails

Hi I have a string,which is been created at the run time I want to use this string as a variable to store some data into it. So how can i convert the string into variable name. Can ny one help..??? ...

Sql server function for displaying word frequency in a column

I have a table that lists a freet text input from a survey where enterents were allowed to enter their responses (regarding colours they would like to have in their wedding) I would like to write a sql function that gathers all the information from this column, and orders counts the frequency of each word, ordering the result set by thi...

String to Date in Different Format in Java

Hi, I want to convert String to Date in different Format. For example, I am getting from user, String fromDate = "19/05/2009"; (dd/MM/yyyy) I want to convert this fromDate as a Date object of "yyyy-MM-dd" format How can I do this? Thanks in Advance ...

Algorithm for Comparing Words (Not Alphabetically)

Hello, I need to code a solution for a certain requirement, and I wanted to know if anyone is either familiar with an off-the-shelf library that can achieve it, or can direct me at the best practice. Description: The user inputs a word that is supposed to be one of several fixed options (I hold the options in a list). I know the input ...

How can I replace a specific word in C#?

Consider the following example. string s = "The man is old. Them is not bad."; If I use s = s.Replace("The", "@@"); Then it returns "@@ man is old. @@m is not bad." But I want the output to be "@@ man is old. Them is not bad." How can I do this? ...

PHP: string indexing

What is the difference between $str[n] and $str{n}, given that $str is a string. I noticed that both seem to work the same, except that {} does not occur in any documentation I found. ...

How to determine if a String contains invalid encoded characters

Usage scenario We have implemented a webservice that our web frontend developers use (via a php api) internally to display product data. On the website the user enters something (i.e. a query string). Internally the web site makes a call to the service via the api. Note: We use restlet, not tomcat Original Problem Firefox 3.0.10 se...

Convert string to integer

I need help in my code. I would like to write only numbers/integer in my textbox and would like to display that in my listbox. Could someone please check my code below. This seems to give an error. int yourInteger; string newItem; newItem = textBox1.Text.Trim(); if ( newItem == Convert.ToInt32(textBox1.Text)) { ...

connection string of ADO.Net of SQL Server

Hello everyone, I am confused about the connection string format of ADO.Net when connect to a non-default instance of SQL Cluster. I did search but find various samples, could anyone let me know what is the correct format please (if I know the virtual server name and instance name)? I am using trusted connection. thanks in advance, Geo...

Comparing Composer Names, Or How do I find a 'close enough' match between two strings?

After finishing two cs classes, I've started working on a personal project in Java. I am writing a program that will look through a music collection and attempt to set the 'Composer' tag by looking at the filename and meta tags. I am comparing these against a composer list I have created as a simple text file. My question is this: Wh...

isDigit() for rational numbers?

I am trying to evaluate if the string in one of the textbox of my interface is a number (i.e. not text or anything else). In Python, there is a method called isdigit() that will return True if the string only contains digits (no negative signs or decimal points). Is there another way I could evaluate if my string is a rational number (ex...

Format STR_TO_DATE to a date.

Hi I have been able to extract a VARCHAR to a date using string_to_date, however whatever I try the date always echoes as e.g. 2009-05-25 Here is my code that works: $query = "SELECT u.url_id, url, title, description, STR_TO_DATE( pub_date, '%d-%b-%Y') AS pub_date FROM urls AS u, url_associations AS ua WHERE u.url_id = ua.url_id AN...

Converting UUIDs from one format to another

I have an SQL document formatted as so (It has about 3000 entries like so): INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('99b857afcb2e4f7dbf8657ea916ad9d7',FALSE,'SPACE') INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) VALUES('df8480e333c044f08ada939c66fa13f5',FALSE,'AIR') INSERT INTO DATA(UUID, IS_SIMULATED, ENVIRONMENT) ...