Search Results

Search found 15239 results on 610 pages for 'array population'.

Page 27/610 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • vb.net one dimensional string array manipulation difficulty

    - by Luay
    Hi, I am having some problems with manipulating a one dimensional string array in vb.net and would like your assistance please. My objective is to get 4 variables (if possible) from a file path. these variables are: myCountry, myCity, myStreet, Filename. All declared as string. The file location is also declared as string. so I have: Dim filePath As String to illustrate my problem and what I am trying to do I have the following examples: 1- C:\my\location\is\UK\Birmingham\Summer Road\this house.txt. In this example myCountry would be= UK. myCity= Birmingham. myStreet=Summer Road. Filename=this house.txt 2- C:\my Location\is\France\Lyon\that house.txt. here myCountry=France. myCity=Lyon. There is no street. Filename=that house.txt 3- C:\my Location is\Germany\the other house.txt Here myCountry=Germany. No city. No street. Filename=the other house.txt What I am trying to say is I have no idea before hand about the lenght of the string or the position of the variables I want. I also don't know if I am going to find/get a city or street name in the path. However I do now that i will get myCountry and it will be one of 5 options: UK, France, Germany, Spain, Italy. To tackle my problem, the first thing I did was Dim pathArr() As String = filePath.Split("\") to get the FileName I did: FileName = pathArr.Last To get myCountry I did: If filePath.Contains("UK") Then myCountry = "UK" ElseIf filePath.Contains("France") Then myCountry = "France" ElseIf filePath.Contains("Germany") Then myCountry = "Germany" ElseIf filePath.Contains("Spain") Then myCountry = "Spain" ElseIf filePath.Contains("Italy") Then myCountry = "Italy" End If in trying to figure out myCity and myStreet (and whether they exist in the string in the first place) I started with: Dim ind As Integer = Array.IndexOf(pathArr, myCountry) to get the index of the myCountry string. I thought I could make my way from there but I am stuck and don't know what to do next. Any help will be appreciated. Thanks

    Read the article

  • I want to scramble an array in PHP

    - by BRUL
    I want PHP to randomly create a multi-dimensional array by picking a vast amount of items out of predefined lists for n times, but never with 2 times the same. Let me put that to human words in a real-life example: i want to write a list of vegetables and meat and i want php to make a menu for me, with every day something else then yesterday. I tried and all i got was the scrambling but there were always doubles :s

    Read the article

  • Array from Requests

    - by Joseph Robidoux
    Hi ive set up 2 scripts, both communicating back and forth. One thing id like is for 1 script to post an unknown amount of GETs to the other script. Id like the other script to some how be able to grab all the GETS and put the values in an array.

    Read the article

  • bash: assign grep regex results to array

    - by Ryan
    Hello everyone, I am trying to assign a regular expression result to an array inside of a bash script but I am unsure whether that's possible, or if I'm doing it entirely wrong. The below is what I want to happen, however I know my syntax is incorrect: indexes[4]=$(echo b5f1e7bfc2439c621353d1ce0629fb8b | grep -o '[a-f0-9]\{8\}') such that: index[1]=b5f1e7bf index[2]=c2439c62 index[3]=1353d1ce index[4]=0629fb8b Any links, or advice, would be wonderful :)

    Read the article

  • Counting Alphabetic Characters That Are Contained in an Array with C

    - by Craig
    Hello everyone, I am having trouble with a homework question that I've been working at for quite some time. I don't know exactly why the question is asking and need some clarification on that and also a push in the right direction. Here is the question: (2) Solve this problem using one single subscripted array of counters. The program uses an array of characters defined using the C initialization feature. The program counts the number of each of the alphabetic characters a to z (only lower case characters are counted) and prints a report (in a neat table) of the number of occurrences of each lower case character found. Only print the counts for the letters that occur at least once. That is do not print a count if it is zero. DO NOT use a switch statement in your solution. NOTE: if x is of type char, x-‘a’ is the difference between the ASCII codes for the character in x and the character ‘a’. For example if x holds the character ‘c’ then x-‘a’ has the value 2, while if x holds the character ‘d’, then x-‘a’ has the value 3. Provide test results using the following string: “This is an example of text for exercise (2).” And here is my source code so far: #include<stdio.h> int main() { char c[] = "This is an example of text for exercise (2)."; char d[26]; int i; int j = 0; int k; j = 0; //char s = 97; for(i = 0; i < sizeof(c); i++) { for(s = 'a'; s < 'z'; s++){ if( c[i] == s){ k++; printf("%c,%d\n", s, k); k = 0; } } } return 0; } As you can see, my current solution is a little anemic. Thanks for the help, and I know everyone on the net doesn't necessarily like helping with other people's homework. ;P

    Read the article

  • C array initialization.

    - by chrisdew
    Why does static char *opcode_str[] = { "DATA" , "DATA_REQUEST_ACK" , "ACK_TIMER_EXPIRED" , "ACK_UNEXPECTED_SEQ" , "ACK_AS_REQUESTED" } ; work, but static char **opcode_str = { "DATA" , "DATA_REQUEST_ACK" , "ACK_TIMER_EXPIRED" , "ACK_UNEXPECTED_SEQ" , "ACK_AS_REQUESTED" } ; fails with SEGV when opcode_str[0] is printf'd? I think it's because the second listing has not allocated memory for the five element array of pointers, but I need a more comprehensive explanation. All the best, Chris.

    Read the article

  • Sort an array with special characters - iPhone

    - by ncohen
    Hi everyone, I have an array with french strings let say: "égrener" and "exact" I would like to sort it such as égrener is the first. When I do: NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:descriptor]; NSArray *sortedArray = [myArray sortedArrayUsingDescriptors:sortDescriptors]; I get the é at the end of the list... What should I do? Thanks

    Read the article

  • Java - easily convert array to set

    - by Peter
    Hey, I'd like to convert an array to a set in Java. There are some obvious ways of doing this (i.e. with a loop) but I would like something a bit neater, something like: java.util.Arrays.asList(Object[] a); Any ideas? Cheers, Pete

    Read the article

  • Array Concatenation in C#

    - by Betamoo
    1- How to smartly initialize an Array with 2 (or more) other arrays in C#? double[] d1=new double[5]; double[] d2=new double[3]; double[] dTotal=new double[8];// I need this to be {d1 then d2} 2- Another question: How to concatenate C# arrays efficiently? Thanks

    Read the article

  • Why is my PowerShell multi dimensional array being interpreted as a 1 dimensional array?

    - by Jim
    I have the following code: function HideTemplates($File, $Templates) { foreach ($Template in $Templates) { Write-Host $Template[0] $Template[1] $Template[2] } } HideTemplates "test.xml" @(("one", "two", "three")) HideTemplates "test.xml" @(("four", "five", "six"), ("seven", "eight", "nine")) It prints: o n e t w o t h r four five six seven eight nine I want it to print: one two three four five six seven eight nine Am I doing something wrong in my code? Is there a way to force PowerShell to tread a multi-dimensional array with a single item differently?

    Read the article

  • sort array of size n

    - by Grv
    if an array of size n has only 3 values 0 ,1 and 2 (repeated any number of times) what is the best way to sort them. best indicates complexity. consider space and time complexity both

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >