arrays

Would the javascript .split(' ') leave the commas in the array?

I have a space separated string that I want to make into an array. I am using the .split(' ') method to do this. Will the resulting array have those spaces in it? For example if my string is "joe walked down the street" and I performed the method on it would the array look like this ["joe", "walked", "down", "the", "street"] or will it l...

PHP Looping through an array with strings AND an array inside

Hi all, This is a basic looping question but with a twist, so it's likely that i'm missing something easy - apologies in advance... I'm trying to pull the results from an array $testoutput - which is filled with 3 arrays: Running the following code: foreach ($testoutput as $ID => $Array) { echo $Array . "<BR>"; } Returns: ARRAY ...

c#: initialize a DateTime array

Hey guys, im a bit lost on how to do this. I know how to initialize an array with values at the time of declaration, but how would i do it with a DateTime type array since it takes multiple arguments to create a date?? ...

Does the immediate window provide a nice way to display a primitive array?

I dynamically assigned an array as follows: unsigned char **nonces=new unsigned char*[n_cases] Is there a way to nicely print it out in the immediate window? Alternatively, it would be nice to make the locals window display it properly. ...

Domize algorithm

I'm trying to figure out how http://domize.com codes their site for speed (I'm using C#). For example, if I search for [cns][vwl][cns][cns][vwl][cns] This will search for a 6 letter domain name that is in this order consonant, vowel, consonant, consonant, vowel, consonant Resulting in: babbab babbac babbad babbaf ... zuzzux zuzzuy ...

Why can we delete arrays, but not know the length in C/C++?

Possible Duplicate: C programming : How does free know how much to free? How is is that it is possible for us to delete dynamically allocated arrays, but we can't find out how many elements they have? Can't we just divide the size of the memory location by the size of each object? ...

JS associative array with duplicate names

ok, so I have an array like: var myarray = { "field_1": "lorem ipsum", "field_2": 1, "field_2": 2, "field_2": 6 }; as you see there are duplicate names in the array, but with different values. If i go through it like (using jQuery): $.each(myarray, function(key, value) { console.log(key); console.log(myarray[key]); ...

Array and struct initialize in C++

I would like to initilize some elements of an struct and array in C++. In C you can do: unsigned char array[30] = {[1] = 4, [20] = 4}; struct mystruct { int i; int j; } struct mystruct e = {.j = 2}; But I cannot do it in C++. Is there any way to implement this kind of designated initializers? ...

Iterate an array Android

Hi, what I am trying to do is to display an item on text on the screen and then following the user input chage that text to the next/previous item. I have created a string arry with all the items in (xml) I have then called the array in the Java code and set up the OnclickListners. My problem is that I don't know what is write in the sw...

Array size optimization

Is there any advantage defining an array's size to be a multiple of 8, if using 64 bit UNIX OS? I am intended to use this array for loading data from shared memory. So dependencies may exist on the operating system and the page size. ...

How to convert a string into array in delphi ?

Dear experts: In php and java there are explode and tokenizer function to convert a string into array without punctuations. Are are functions or some way in delphi to do the work. Suppose there is a large file " This is, a large file with punctuations,, and spaces and numbers 123..." How can we get array "This is a large file with punct...

iphone & Objective C - Filtering an array using NSPredicate ???

I have an array of objects (Users) each user has an nsset named "devices" Is it possible to filter so the array returns all users who have a device with a specific name. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"devices.category==%@", @"mobile"]; myArray = [allUsersArray filteredArrayUsingPredicate:predicate]; ...

How to create multidimensional array of inner class objects in java

everything is the title java tutorial says: OuterClass.InnerClass innerObject = outerObject.new InnerClass(); this doesn't work for me: public class aching{ class pixel{ public char c; public int f; } public static void main(String[] args){ aching a = new aching(); aching.pixel[][] p = a...

PHP: Problems finding the most frequent character in a UTF-8 string (eg 唐犬土用家犬尨犬山桑)?

From an MySQL database I can extract the following utf-8 characters: "唐犬土用家犬尨犬山桑山犬巴戦師子幻日幻月引綱忠犬愛犬戌年成犬教条教義" I am trying to find the most frequent character in this string. I tried putting each as element into an array $arr and do array_count_values($arr); Unfortunately the array operations (or is print_r the culprit?) produce mis-encoded...

JQuery + Json - first steps with an example

Hi. I need (recently) to get an array from the server after an ajax call created by jquery. I know that i can do it using JSON. But i don't know how to implement it with JQuery (im new with JSON). I try to search in internet some example, but i didnt find it. This is the code : // js-jquery function function changeSponsor() { $.aja...

Getting the array length of a 2D array in Java

I need to get the length of a 2D array for both the row and column. I’ve successfully done this, using the following code: public class MyClass { public static void main(String args[]) { int[][] test; test = new int[5][10]; int row = test.length; int col = test[0].length; System.out.println(row); System.out.println...

parsing/searching a beastly array filled with simple xml objects in php

Hi, So Im working on a Excel xml parsing class, and Im trying to search through an array of the header values of the file, to return the key integer. If I can get the key int, then I can grab an entire column by the value of the header in the file. I have tried using in_array, search_array and a bunch of other functions, but nothing is ...

How to convert a String into a String[][]

I have a string like this: String string ='{{"INPUT FILE", "NUMBER OF RECORDS"},{"Item File", "11,559"},{"Vendor File", "300"}, {"Purchase History File", "10,000"},{"Total # of requisitions", "10,200,038"}}'; And I want to convert it into an array like this: String [][] data = { {"INPUT FILE", "NUMBER OF RECORDS"}, ...

How can I create a time-series array so I can have a bar graph in Ruby on Rails?

I have a model, ContactEmail that has a date_sent attribute and an email_id, referencing another model Email. I would like to create a bar graph which shows on the x-axis dates and on the y-axis the number of ContactEmails that were sent on a specific date. I would like to also do the same, filtered for ContactEmails where email_id equ...

How can I create an array of ints in Rails 3. Please help!

Hello! I have a very small question. How can I convert these: [172592596,93038592,154137572] To look like these: ['172592596','93038592','154137572'] Thankful for all help! ...