24
votes
6answers
40k views

How to split a String by space

I need to split my String by spaces. For this I tried that: str = "Hello I'm your String"; String[] splited = str.split(" "); But it doesn't seems to work, what do I have to change?
12
votes
5answers
4k views

C#: string[] to delimited string. Is there a one-liner?

What I'd prefer is something like: string[] strArray = {"Hi", "how", "are", "you"}; string strNew = strArray.Delimit(chDelimiter); However, there is no such function. I've looked over MSDN and ...
8
votes
6answers
16k views

Explode and Implode(just like php) in java [closed]

I am new in JAVA although had a good experience in PHP , and looking for perfect replacement for explode and implode(Available in PHP) functions in JAVA . I have Googled for the same but not ...
6
votes
4answers
2k views

Element-wise string concatenation in numpy

Is this a bug? import numpy as np a1=np.array(['a','b']) a2=np.array(['E','F']) In [20]: add(a1,a2) Out[20]: NotImplemented I am trying to do element-wise string concatenation. I thought Add() was ...
5
votes
2answers
7k views

Pointer to string array in C

Playing with pointers in C is fun (not really). I have several arrays of strings I want to declare in an easy way, preferably something like: arrayOfStrings1 = {"word1", "word2", etc. }; ...
4
votes
7answers
3k views

How to append String at particular index in an array of Strings

I have a String array like below: String[] titles = new String[] { "Booking", "Entry", "Type", "Duration", "Status", "Contract ID", "Capacity", "Start Day", ...
3
votes
1answer
624 views

How to get Android String Array if i have Array name in another String

I have a problem, a technical one. I have a list view, when I click an item I get content at that specific position and send it to next activity through 'putExtra' On next activity what i am doing is ...
3
votes
6answers
2k views

how to convert arraylist to string array with all items in double quote

In my application i m getting a problem.. i am getting data from server into ArrayList. but i am unable to convert that list in to a String array in which all data items are in double quoted. my code ...
3
votes
2answers
188 views

how to NAME a string-array using a string resource

How can I do this? <string-array name="@string/a_string_from_resources"> Is it possible to name a string-array using a string Resource? <?xml version="1.0" encoding="utf-8"?> ...
2
votes
3answers
650 views

Returning a string array as a single string from a method

I have a string array variable. private string[] _documents; Values to it are assigned like this. string[] _documents = { "doc1", "doc2", "doc3" }; And there's a method which adds a string to ...
2
votes
1answer
200 views

Find matching string from List of Class/Object

I have an array of string : string[] PropertyIds= new string[5]; A List of Class(Property) List<Property> properties = new List<Property>(); The class Property has following fields: ...
2
votes
2answers
92 views

String array and string

i'm working on a program for my class but now i have a problem with spliting string and substrings. I have saved data from different classes in a string with a delimiter for later a later split(/). ...
2
votes
2answers
111 views

How can i derive specific data from the string?

I have the following string and i want to derive the number (104321) from the a href tag . How can i derive this number . Hello this is testing string <a ...
2
votes
3answers
119 views

Size of String in C 64 bit machine

char Str[][5]={"one","two","three","four","five"}; char Str1[][6]={"one","two","three","four","five","six"}; printf("Size of Str is %d",sizeof(Str)); printf("\nSize of Str1 is %d",sizeof(Str1)); ...
2
votes
1answer
598 views

Format string array to reverse strings

I am wonding if it is possible to reverse my output so that the strings are written in the reverse order (correctly)? So I am using the following code to split a string: String[] capitalArray = ...
1
vote
12answers
6k views

removing an element from String array in android

Am doing a simple android application.In that I am deleting an element from array using the following code. arr_fav = {"1","2","3"}; for(int i= 0;i<arr_fav.length;i++) { if(current_id == ...
1
vote
4answers
280 views

Splitting a string in Java,

I am trying to split a string into a string array, but when it splits the string only the first part, before the split, is in the array in the [0] slot, but nothing is in [1] or later. This also ...
1
vote
2answers
112 views

Need an better method of removing pattern within a string

I have a method that to remove the description word base on the string, but I believe that there is more efficient way to do this. The iMonster can be like fat orc rogue, and I want to remove the ...
1
vote
4answers
478 views

How do you use a string array in a conditional statement in C?

I want to use a string array in an if statement to test whether the input string matches any of the strings in the array. So far this is what I've tried: void checkForError(char input[50]) { ...
1
vote
3answers
1k views

Foreach loop causes NullReferenceException

At the top of my code (before constructor) I write: String[] CAN = null; This string array is updated in another function. Later in my code I have this foreach loop: foreach (String str in CAN) { ...
1
vote
3answers
1k views

Comparing two string arrays with a Nested For loops

Hi I'm trying to find matches between two string array using a nested for loops. However it seem to have looped around more times. for(int i = 0; i < ca; i++) //ca contains 10 { for(int j = 0; ...
1
vote
3answers
293 views

What's wrong with this simple code using strings, malloc and strcat?

A char** always confuses me. The following code generates a segmentation fault. Explain please... #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char** ...
1
vote
3answers
3k views

Java - Convert String to String Array

I am new to Java. Please help me. Below is the string after implementing HTTP POST method as a response: {"Result":"{ \"Search\": [ { \"Code\": \"200\" }, { \"Message\": ...
1
vote
3answers
913 views

split string without delimiter and stored in an array using vb.net

The variable datatype is string .it contain string value like greater than 300 chars. i want to split that string by 150 char and stored in the string array using vb.net My code: msg = t1("fld_msg") ...
1
vote
1answer
404 views

Calling a Resource by a string?

Here's the setup. I have a spinner, and each item in the spinner is associated with their own StringArray. I want to streamline the process of loading the StringArray when an item is selected in the ...
1
vote
1answer
8k views

Get a string-array into a string

I have a set of strings I originally was using with an ArrayAdapter to populate a Spinner. Instead of a Spinner, I want to use a BaseExpandableListAdapter. Is there a way I can get a set of ...
1
vote
1answer
88 views

How to breakout the following code into individual classes in android [closed]

I have the following code that works and gives me the solution that I am looking for, however what I would like to do is break out the following section into i's own class so that I can initialize the ...
0
votes
4answers
2k views

Remove trailing slash from String in Java

I am trying to remove the last character from a string, if it is a /. I am using a string array, temp[], to store the strings. Here's my code: char ch = ' '; for (int st = 0; st < temp.length; ...
0
votes
7answers
150 views

Java string comparsion [duplicate]

I'm trying to implement a simple cesar cipher. I'm having trouble with the function that codes a string based on a new key[]. Here I shown, how I setup my key. private String[] alphabet = {"a", ...
0
votes
2answers
297 views

Populating a string array using a string? (JAVA)

I was looking around the site for some similar answers but I haven't found anything so far. I am wondering how I can populate a string array with a pre-established string. Also, if I have a separate ...
0
votes
4answers
180 views

Add a price to a string array

So i have a string array full of different vodkas, what i want to do is attach a price to each vodka (string) in the array so that i can display the vodka along with its price on the screen, i ...
0
votes
3answers
2k views

How to convert String to byteArray and byteArray to String Array in java?

I want to convert String to bytearray in java.. For Example i want output like the following : String s = "82,73,70,70,90,95,3,0,87,65,86"; Now the logic is , i want same String value in bytearray ...
0
votes
1answer
2k views

How do i use one string array entry based upon its position within the array (Android)?

I'm trying to produce a simple oracle app where when you ask the app a question it spits out an answer based on a random number. I've done some research and it seems to me the best practice way of ...
0
votes
2answers
2k views

pointer array with strings using malloc and buffer in C

I am stuck in how to fill a pointer array with strings using malloc. In debug i see that when i fill the 1st pointer of array with a string, when its about to go to next pointer in the array it pass ...
0
votes
3answers
3k views

Caused by: java.util.NoSuchElementException

Hello all i am working with following code code is work fine with below string StringTokenizer st = new StringTokenizer("abc,koch, Ranchi, zalkhand, NY, 10001, India"); but when i remove any ...
0
votes
2answers
181 views

How do I derive specific data from a string using the Java standard API?

I have the following pattern: Jan(COMPANY) &^% Feb(ASP) 567 Mar(INC) I want the final output to be: String[] one = {"Jan", "Feb", "Mar"}; String[] two = {"COMPANY","ASP","INC"}; Please ...
0
votes
3answers
109 views

Java: Creating an array of random string numbers

I have a set of code that, currently, uses a pre-set list of 30 manually inputed strings made up of numbers, which can be seen below: String[] elementsToAdd2 = { "100", "510", "170", "214", ...
0
votes
2answers
36 views

why String Array did't tak a string as first Index

I have the following code. There is problem in String[] sep2=strAdder; compiler suggests that change the sep2 to String or change the type of strAdder to String[]. I am confused about that. I think it ...
0
votes
1answer
69 views

Strings and int comparsion for yahoo weather API

I'm developing a simple weather applications using the yahoo API. The method weatherInfo.getCurrentText() results in a string with the current weather condition in English. For each weather ...
0
votes
4answers
72 views

Splitting a string in substrings and putting those in a String []

So I have a string which i'm splitting up in substrings. Everyone of those substrings should become an element of a new String array. so far I have this: public static void main(String[] args) ...
0
votes
3answers
908 views

Joining Two 2D String Arrays

I have two 2D string arrays: string[,] stringArray1 = { {name1, name2, name3, name4, name5}, {value1, value2, value3, value4, value5}}; string[,] stringArray2 = { ...
0
votes
3answers
534 views

How To Put String Value in String Array ?? Code Attached (Error: Object reference not set to an instance of an object.)

i am getting error "Object reference not set to an instance of an object." my is here, public class UserProfession { public UserProfession() { } public ...
0
votes
1answer
106 views

For an Android app, how do I read a string from an *.xml file?

Let's start with the Hello World program detailed at http://developer.android.com/resources/tutorials/hello-world.html . Let's add the file res/values/arrayfile.xml . Unfortunately, Stack Overflow ...
0
votes
3answers
61 views

How to convert Xml to string array

Currently the application that I am working on returns XML into a string. String xml = getData(); But now I need to convert this to a string array, the Xml will something like this: ...
0
votes
1answer
67 views

get only the strings from a custom arraylist and make a string array using the strings

Objective: Create a new class (diaryLogs) with these fields to hold the values and a single constructor that takes an int (0 Mon, 1 Tue, 2 Wed etc) and two strings for the date time and diary entry ...
0
votes
1answer
44 views

How do I properly assign pointers in string array in C?

I struggle with pointers in C. I need to put first element of each line into an array. Important parts : char shipname[10]; char **shipTable = NULL; while ( fgets( line,100,myfile) != NULL ) { ...
0
votes
3answers
277 views

How to make a String array case insensitive in Android

I am currently creating an application that will read an NFC tag and look up the text of the tag against a string array to see if it is there. It works if the tag is case sensitive correct e.g. ...
0
votes
1answer
349 views

string-array inside string-array

I want to create a string-array inside another string-array like this: <string-array name="names"> <string-array name="man"> <item>Jake</item> ...
0
votes
1answer
514 views

Extract token positions from String Array- Java

I'm just asking whether there is a simple way to extract a string out of a string array in java. For example if i've the input: String searchtext = "The one thing"; String source = "the one Thing in ...
0
votes
2answers
492 views

Adding entire string array to adapter

I'm sure this has already been asked, so if somebody can refer me to another thread that'd be great. I've got a string array: String animalArray[] = {"Dog", "Cat", "Horse", "Snake"}; And I've ...