string

jquery/javascript convert date string to date

I have a date string "Sunday, February 28, 2010" that I would like to convert to a js date object formatted @ MM/DD/YYYY but don't know how. Any suggestions? ...

Draw string in canvas

Hey there! I'm having an hard time finding how to draw/print a String in a canvas, rotated 90º, NOT vertical letters. After some different approaches without success I was trying to follow one that would involve printing the Graphics object to an Image object. As the API is reduced it has been a difficult task. So basically what I'm ask...

Is it possible to build a system that has no restrictions on username?

If yes, then why are simple characters like dots (.) and underscores (_) not allowed in some services? Generally, as a developer, what should we look out for when we make the decision of which characters should/shouldn't be allowed in usernames and other text fields? An example: It is frustrating to see the username Senthil already exi...

How to use String arrays in 2D (String[][]) and to parse data in each space (specified element spot)?

I want to get a proxy list and parse it into an array of strings, txt is the proxy list, tmp[] is an array that has element in the form "ipaddr:port". ie. (tmp[] = {"i.p.i.p:port", "i.p.i.p:port", ...}). proxies array should be in 2d and look like this: {{"i.p.i.p","port"}, {"i.p.i.p","port"}, ...} but when running it java complains the ...

Please explain this method for comparing strings

for example suppose that some k which is arbitrary number=2 k=2 then there is code in c int wordcomp(char *p, char *q) { int n = k; for ( ; *p == *q ; p++, q++) { if ( *p==0 && --n == 0 ) return 0; } return *p - *q; } please explain me what does this code do? also what means *p-*q?and also how im...

javascript string manipulation

I would like to modify my strings so i can replace the character ' ' with '_' using JS,for example "new zeland"=>"new_zeland" how can i do that? ...

change the data of char array

i have an array of type char char *arg[100] this array its reading the data from somewhere, when that when i print arg[0], it prints the value "help", and when i print the arg[1], it prints the value "exit".. as an example what i want exactly is to change the arg[0] from "help" to anything else, like "man" how i can do that??? than...

Format a string into columns

Is there a cool way to take something like this: Customer Name - City, State - ID Bob Whiley - Howesville, TN - 322 Marley Winchester - Old Towne, CA - 5653 and format it to something like this: Customer Name - City, State - ID Bob Whiley - Howesville, TN - 322 Marley Winchester - Old Towne, CA - 5653 Using ...

C++: Join an array of WCHAR[]s?

I have an array of WCHAR[]s. How can I join them? I know the array length. [L"foo", L"bar"] => "foo, bar" ...

Android/Java Append String + int

Hi, i have a question, what is the best way to append ints and Strings to build a new String? In the allocation debug tool i see too much allocations if i use the operator +. But i have tried also with StringBuffer and there are still too much allocations. Anyone can help me? Thanks ...

Help for creating a random String

I need to create a random string which should be between the length of 6 to 10 but it sometimes generates only about the length of 3 to 5. Here's my code. Can anyone would be able to find out the problem? :( int lengthOfName = (int)(Math.random() * 4) + 6; String name = ""; /* randomly choosing a name*/ ...

How do make my encryption algorithm encrypt more than 128 bits?

OK, now I have coded for an implementation of AES-128 :) It is working fine. It takes in 128 bits, encrypts and returns 128 bits So how do i enhance my function so that it can handle more than 128 bits? How do i make the encryption algorithm handle larger strings? Can the same algorithm be used to encrypt files? :) The function def...

binary file to string

i'm trying to read a binary file (for example an executable) into a string, then write it back FileStream fs = new FileStream("C:\\tvin.exe", FileMode.Open); BinaryReader br = new BinaryReader(fs); byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length)); System.Text.Encoding enc = System.Text.Encoding.ASCII; string myString = enc.GetStri...

When does the difference between a string and a number matter in Perl 5?

If a string in Perl 5 passes looks_like_number, it might as well be a number. For instance, my $s = "10" + 5; results in $s being assigned 15. Are there any cases where a string does not behave like it's numeric equivalent would have? ...

Regular expression with no maximum limit

I Need a regular expression which accepts all types of characters (alphabets, numbers and all special characters), and miniumum number of characters should be 15 and no limit for maximum characters. ...

PHP Speed - Many Echos vs Building a String

Wondering if anyone knows if either of these methods would produce an output faster: Method 1 for ($i=1;$i<99999;$i++) { echo $i, '<br>'; } or Method 2 for ($i=1;$i<99999;$i++) { $string .= $i . '<br>'; } echo $string; Thanks for any input you have. ...

Algorithm for multiple word matching in a text, count the number of every matched word

I have noticed that it has solutions for matching multiple words in a given text, such as below: http://stackoverflow.com/questions/1099985/algorithm-for-multiple-word-matching-in-text If I want to know exactly the number of appearances of each matched word in the text, my solution is like this: step 1: using ac-algorithm to obtain the...

Using a function with variable argument strings

I was playing around a bit with functions with variable arguments, and decided to make a function to create vectors with the arguments. My function for creating an int vector worked... vector<int> makeIntVector(int numArgs, ...) { va_list listPointer; va_start(listPointer, numArgs); vector<int> made; for(int a = 0; a < n...

Java: Print and access List <String[]>

Im reading in a file and storing it in t1. How do i access the elements in t1? When i try to print it i get addresses instead of values. Also whats the dif between string and string[]? CSVReader reader = new CSVReader(new FileReader("src/new_acquisitions.csv")); List <String[]> t1 = reader.readAll(); int i = 0 ...

Java: Combine 2 List <String[]>

I have two List of array string. I want to be able to create a New List (newList) by combining the 2 lists. But it must meet these 3 conditions: 1) Copy the contents of store_inventory into newList. 2) Then if the item names in store_inventory & new_acquisitions match, just add the two quantities together and change it in newList. 3)...