🔒 Closed Help po

Status
Not open for further replies.
hello patulong sa coding kahapon ko pa to pinoproblema di ko talaga magawan ng paraan


Suppose may array ka:
Array A contains elements:
(index 0) Cash on hand, Accrued Depreciation, Land
(index 1) Vehicles, Accounts Payable
(index 2) Capital, Withdrawal, Notes Payable

Automatically ang length syempre ng array ay kung ilan ang laman na elements

Ang objective dito ay maiseparate nya yung mga account titles sa isa't isa so for example sa array natin. Ang dapat na kalabasan ay:
(index 0) Cash on hand
(index 1) Accrued Depreciation
(index 2) Land
(index 3) Vehicles
(index 4) Accounts Payable
(index 5) Capital
(index 6) Withdrawal
(index 7) Notes Payable

So kung makikita niyo naseparate yung mga word/s per comma. Help po
 
Split ang gusto mong mangyayari paps, ito ang sample code.

String animals = "dog, cat, bird, fish, snakes";

String[] animalsArray = animals.split(",");
 
String[] a ={"Accrued", "Depreciation" ,"Land" , "Vehicles" , "Accounts Payable" , "Capital" , "wí†hdráwal" , "Notes Payable"}

for(i = 0; i <= a.length(); i + +) {
System.out.println(a) ;
 
Concatenate mo po yung lahat ng strings then do the split.
Ang gusto ko po kasi mangyari paps

lets say:

String animals1 = "dog, cat, bird";
String animals2 = "fish, snakes";
String animals3 = "turtle, goat, sheep, cow, lion";
and so on..

Gusto ko po sa iisang array
may laman siya na::
dog
cat
bird
fish
snakes
turtle
goat
sheep
cow
lion

Nagegets nyo po ako?
 
Ang gusto ko po kasi mangyari paps

lets say:

String animals1 = "dog, cat, bird";
String animals2 = "fish, snakes";
String animals3 = "turtle, goat, sheep, cow, lion";
and so on..

Gusto ko po sa iisang array
may laman siya na::
dog
cat
bird
fish
snakes
turtle
goat
sheep
cow
lion

Nagegets nyo po ako?
yes, concatenate(pagsamasamahin mo lahat ng string sa array) then tsaka mo i-split

Sample:
Java:
public class Main{
    public static void main(String[] args) {
        String[] array = {"1, 2, 3", "4, 5, 6", "7, 8, 9"};
        String concatenatedArray = array[0] + ", " + array[1] + ", " + array[2];
        String[] splitted = concatenatedArray.split(",");
    }
}
 
yes, concatenate(pagsamasamahin mo lahat ng string sa array) then tsaka mo i-split

Sample:
Java:
public class Main{
    public static void main(String[] args) {
        String[] array = {"1, 2, 3", "4, 5, 6", "7, 8, 9"};
        String concatenatedArray = array[0] + ", " + array[1] + ", " + array[2];
        String[] splitted = concatenatedArray.split(",");
    }
}
Salamat po paps! Laking tulong ☺️
 
Status
Not open for further replies.

About this Thread

  • 8
    Replies
  • 586
    Views
  • 4
    Participants
Last reply from:
Handnasomepa

Trending Topics

Online now

Members online
945
Guests online
1,334
Total visitors
2,279

Forum statistics

Threads
2,272,141
Posts
28,940,467
Members
1,238,018
Latest member
Rjmnrs
Back
Top