473,791 Members | 2,827 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.Tha nk 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 1932
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.Tha nk 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.Scann er;

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

System.out.prin tln("Enter 3 Words Separated With Spaces : ");
String Word=Scanner.ne xtLine();

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

System.out.prin t(result[x].charAt(0));
System.out.prin tln();
}
}
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.Scann er;

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

System.out.prin tln("Enter 3 Words Separated With Spaces : ");
String Word=Scanner.ne xtLine();

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

System.out.prin t(result[x].charAt(0));
System.out.prin tln();
}
}
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
2554
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 classes or libraries have the capabilities to load an existing PDF into memory and basically add in the login portion of it dynamically. Or, if anyone knows of a 3rd party executable that can handle this, that would be great too. -- thnx, Chris...
0
1560
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 categories and group from a text string that is delimited by a "| ". (see string examples below). I have managed to find some javascript that will handle the different levels of categories without having to keep refreshing the page. So I want...
1
3474
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 value representing the width of the bmp image. So far, I have been able to use fstream's seek, write, and read to pull out chucks of bytes and convert them to usable integers straight out of the binary file. It works well, but over the course of...
32
14902
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 ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
4
3493
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 substrings need be replaced, or one character needs be changed, what shall I do? Is it better to convert strings to UCS-32 before manipulation? But on Windows, wchar_t is 16 bits which isn't enough for characters which can't be simply encoded...
9
3379
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 image that need manipulating is places on the server. dont need js for that ;-) 2. the client has the oppotunity to manipulate the image. cut and zoom. 3. the image i saved on the server.
1
1058
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 and process that item and move on to the next item in the arraylist and if it encounter box and the
232
13357
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 set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
1
2981
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 https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/xxx.jpg However I need to manipulate it so it also displays like this; https://xxx-xxx.xxx.xxx.com/content/00000xxx/xxx/_t/xxx_JPG.jpg
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10154
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4109
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 we have to send another system
2
3713
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.