473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String Manipulation //Just cant handle

H0kage
6 New Member
Hello everyone got an assignment for college where i cant find the way to make
JDeveloper to understand where the words are separated.This What
The Assignment Asks.Any Tip or example to help me finish it would be greatly apreaciated.Thank you in advance.




Following is an example of screen results that might appear, depending on the data the user inputs.

This program asks the user for three words.

The first letter of each word must be extracted, and then an acronym must be formed with the 3 letters of each word you have extracted.

Enter 3 words separated by blanks: Going To Pass

The acronym should be in this form : GTP
Oct 24 '06 #1
3 1917
r035198x
13,262 MVP
Hello everyone got an assignment for college where i cant find the way to make
JDeveloper to understand where the words are separated.This What
The Assignment Asks.Any Tip or example to help me finish it would be greatly apreaciated.Thank you in advance.




Following is an example of screen results that might appear, depending on the data the user inputs.

This program asks the user for three words.

The first letter of each word must be extracted, and then an acronym must be formed with the 3 letters of each word you have extracted.

Enter 3 words separated by blanks: Going To Pass

The acronym should be in this form : GTP
What have you done so far?
Oct 25 '06 #2
H0kage
6 New Member
With some research in this forum and some help from a friend i managed to get a clue and solve it.Thank You for your reply :)

This is my solution in which dont think there is an error.Feel free to correct me.



import java.util.Scanner;

public class String_Acronym {
static Scanner Scanner=new Scanner(System.in);
public static void main(String[] args) {

System.out.println("Enter 3 Words Separated With Spaces : ");
String Word=Scanner.nextLine();

String[] result = Word.split("\\s");
for (int x=0; x<result.length; x++)

System.out.print(result[x].charAt(0));
System.out.println();
}
}
Oct 25 '06 #3
r035198x
13,262 MVP
With some research in this forum and some help from a friend i managed to get a clue and solve it.Thank You for your reply :)

This is my solution in which dont think there is an error.Feel free to correct me.



import java.util.Scanner;

public class String_Acronym {
static Scanner Scanner=new Scanner(System.in);
public static void main(String[] args) {

System.out.println("Enter 3 Words Separated With Spaces : ");
String Word=Scanner.nextLine();

String[] result = Word.split("\\s");
for (int x=0; x<result.length; x++)

System.out.print(result[x].charAt(0));
System.out.println();
}
}
An elegant solution. Now make it a point never to forget the power of regular expressions. Mastering them now will save you a lot of code in the future.
Oct 26 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2536
by: Chris Mosser | last post by:
I have a client who would like to host a PDF on his site, but make it so that each individual that downloads it has to open it with a separate username and password. My question is if any php...
0
1551
by: Sean Williams | last post by:
I have been working in this problem for weeks and I was determined to sort it myself however I feel I need guidance to proceed forward. What I am trying to produce is some asp code that can split...
1
3457
by: rusttree | last post by:
I'm working on a program that manipulates bmp files. I know the offset location of each piece of relevent data within the bmp file. For example, I know the 18th through 21st byte is an integer...
32
14761
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
3470
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
9
3338
by: zacariaz | last post by:
I dont know, and i dont much like javascript, however, i am told that the only way to do want i want to do, is with javascript, so here goes. zoom and cut is the only features i need. 1. the...
1
1050
by: dotnetnoob | last post by:
hello, i have a arraylist /box /box/boxTest /vbox/vboxTest /vbox is it possible to process each item in the arraylist as string and if first encounter "/" then get the value for example box...
232
13064
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
1
2963
by: adam bob | last post by:
Hello, I'm struggling with an image mechanism I'm trying to build which basically manipulates a URL string. This is the sort URL that is gained from an InfoPath form ...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.